-
Flip the screen
Hey guys,
I need to flip the image being displayed to the user. I need to flip it in such a way that when looking at the screen it's as if you were looking at it in a mirror. I have been reading some stuff on how to get a screenshot but that seems like it will be VERY slow. Is there a way I can just hijack the video card output before it is drawn to the monitor? Or do you think that just screen-shotting via the windows api and manipulating the image is the best way for me to go?
Thank you!
-
When working in windows you should *never* mess directly with hardware. All hardware is a shared resource used by all programs... you may get what you want but at the expense of every other program running on the system.
If you have a good reason to do this (eg. a funny screen saver) do it in such a way that it *cannot* affect other programs. Take your screenshot and do the work to reverse it.
-
alright, is getting a screenshot fast enough in the code so that I can display the results in a different window viewing a 1 to 1 relationship? I suppose I can code some stuff up to decide that. I suppose since messing with the hardware is forbidden that is my only option... Any other suggestions are welcomed. Thank you!
-
Getting a screenshot should not be any slower than making a copy of a BMP being displayed onscreen... A few milliseconds, most likely...
This might help...
Capturing an Image (Windows)
-
What image is the user seeing? Is it one you create? Do you control the paint msg handling?
StretchBlt() will allow you to invert (Mirror) the image.
Can look at the DSTINVERT flag (never used it so not sure what exactly it inverts)
Or something like.....
Code:
//On app start create compatible DC and BMP (destDC) the same size as the screen/window
//capture screen into sourceDC when required
//call one or both inverts
//horizontal invert
StretchBlt(destDC, 0, 0, bmpWidth, bmpHeight, &sourceDC, bmpWidth-1, 0, -bmpWidth, bmpHeight, SRCCOPY );
//vert invert
StretchBlt(destDC, 0, 0, bmpWidth, bmpHeight, &sourceDC, 0, bmpHeight-1,bmpWidth, -bmpHeight, SRCCOPY );
//use destDC in paint msgs (BitBlt() using the PAINTSTRUCT's DC and Rect)
//clean up GDI on close