#### Archived

This topic is now archived and is closed to further replies.

# DirectDraw Mirror Image

This topic is 5270 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi people. I''m struggling to mirror the image on a DirectDraw surface. I have successfully blitted a bitmap on the screen, but cannot achieve a mirror if the source and destination surfaces are the same size. Can someone point me to an example/tutorial that uses DirectDraw 7 or Win32 GDI? Thanks in advance.

##### Share on other sites
Have you tried blitting from a source RECT that has opposite coords?
srcRect.left = 0; srcRect.top = 0; srcRect.right = 10; srcRect.bottom = 10;
you would have:
srcRect.left = 10; srcRect.top = 10; srcRect.right = 0; srcRect.bottom = 0;
I think that works.

Dave.

##### Share on other sites
Although it does work, I found that it is not widely supported and has to be emulated on some cards, which obviously reduces the drawing speed dramatically.
At the time I was puzzled by the fact that my old FireGL Pro was able to display more sprites than my GF2, which turned out to be due to the mirroring.
If you want your game to run smooth on any graphics card, I would advice to just include the mirrored images on your sprite sheets.

##### Share on other sites
How about using DirectDraw Blit Effects?

DDBLTFX        ddbltfx;               // used for ////////////////////////////////////////////////////////	memset(&ddbltfx,0,sizeof(ddbltfx)); //clear ddbltfx.dwSize = sizeof(ddbltfx) ;ddbltfx.dwDDFX = DDBLTFX_MIRRORLEFTRIGHT  ; //specify flip effectlpddssurface->Blt(&dest, BmpDDSurface, NULL, (DDBLT_WAIT | DDBLT_DDFX)  , &ddbltfx );

##### Share on other sites
Thanks for the suggestions, guys.

DirectDraw Blit effects was the first thing I tried. For some reason, the image is not mirrored if the source and destination rectangles are the same size. I''m considering blitting to a surface of twice the length and width, and then blitting to the back buffer. It''s improvising, but hopefully it should work without distorting the image.

As for inverting the RECT corners, that seems to blit the image off the destination.

I''ve spent these two days pulling my hair out for this problem. For now, I will cut down on mirror-ing in my game. Where I really must, I''ll try double blitting and loading mirrored bitmaps (as AP suggested). I appreciate the help nonetheless.