DirectDraw 7.0 Blt Bug?

Started by
3 comments, last by flamewill 20 years, 8 months ago
So far I have successfully loaded bitmaps to DirectDraw surfaces and flip them to create animation. Right now I am trying to mirror an image and the most peculiar thing happens. Snippets of my code as follows. The mirror (and color key) works only if the destination rectangle has a different height/width than the source rectangle. Otherwise, I can Blt to the destination, but no mirror and no transparency.

...

destRect.top = y;
destRect.left = x;
destRect.bottom = y + width;
destRect.right = x + height;

ZeroMemory( &ddfx, sizeof( ddfx ) );
ddfx.dwSize = sizeof( ddfx );
ddfx.dwDDFX = DDBLTFX_MIRRORLEFTRIGHT;

result = pCanvas->Blt( &destRect, pSurface, &srcRect, DDBLT_KEYSRC | DDBLT_DDFX, &ddfx );

...
The code as above will blt the image from pSurface to pCanvas. However it will not mirror or use transparency when blitting. Yet if I add one to destRect.bottom or destRect.right, it works. Of course the image is thus a little distorted due to stretching. Just hoping that someone else has also come across this and know what is going on...? [edited by - flamewill on August 15, 2003 8:32:02 PM]
Blt 'em Blittin' Blips.
Advertisement
Thanks for your help, KalvinB. I tried to reply to my previous (identical) post, but the "Reply To Topic" doesn''t work! I really need to get that gremlin off my back.

Back on topic. It must have something to do with the RECT''s because blitting that image results in the error: DDERR_INVALIDRECT. Unfortunately, even after I adjusted the source and destination rectangles the problem wasn''t fixed.

The more peculiar thing is that the DDERR_INVALIDRECT error only pops up during the first three scans. The image is still there... What am I missing?
Blt 'em Blittin' Blips.
Just found out what the DDERR_INVALIDRECT problem is: a dumb bug in my code (as it usually is). The initial problem is still there, no mirror, no transparency, and no DDERR...
Blt 'em Blittin' Blips.
i find it odd that whenever something doesn''t work, people blame microsoft, or whoever else may have supplied the library. the truth is, 99.9999% of the time, its your fault.
Oh, no. Please don''t misunderstand, I''m not blaming Microsoft for this - although I love blaming Microsoft on many other things. I''m trying to find out if others have also experienced this or a similar problem.

I agree that 99% of the time the programmer has overlooked something. That''s why I spend 99% of the time debugging my code, and 1% of the time asking for help in the forums.
Blt 'em Blittin' Blips.

This topic is closed to new replies.

Advertisement