Flip the screen

This is a discussion on Flip the screen within the Windows Programming forums, part of the Platform Specific Boards category; Hey guys, I need to flip the image being displayed to the user. I need to flip it in such ...

  1. #1
    Or working on it anyways mramazing's Avatar
    Join Date
    Dec 2005
    Location
    Lehi, UT
    Posts
    121

    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!
    -- Will you show me how to c++?

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    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.

  3. #3
    Or working on it anyways mramazing's Avatar
    Join Date
    Dec 2005
    Location
    Lehi, UT
    Posts
    121
    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!
    -- Will you show me how to c++?

  4. #4
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    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)

  5. #5
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,854
    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
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Render text
    By Livijn in forum C++ Programming
    Replies: 6
    Last Post: 07-06-2007, 03:32 PM
  2. Feedback: Functional Specification Wording
    By Ragsdale85 in forum C++ Programming
    Replies: 0
    Last Post: 01-18-2006, 03:56 PM
  3. char copy
    By variable in forum C Programming
    Replies: 8
    Last Post: 02-06-2005, 09:18 PM
  4. i am not able to figure ot the starting point of this
    By youngashish in forum C++ Programming
    Replies: 7
    Last Post: 10-07-2004, 02:41 AM
  5. Converting from Screen to World Coordinates
    By DavidP in forum Game Programming
    Replies: 9
    Last Post: 05-11-2004, 12:51 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21