Sign in to follow this  
renman29

paint prog - resized window to act like full screen

Recommended Posts

renman29    675
I'm trying to write some code so that I can paint into a resized window with something like an airbrush in such a way that it will act exactly as though it were painting into the full screen version of the backbuffer. In other words, I don't want to resize the backbuffer at all. I need to extract the previous (full screen) pixel colors under a given area (like inside the airbrush circle for example), but I need to be able to do this as though it were in full screen mode. Then I need to apply the effect to those pixels and resubmit as thought I were in full screen mode. I thought perhaps the backbuffer remains in tact when I resize, maybe just some kind of mouse coordinate or pixel coordinate conversions?? Has anyone ever done this? Any ideas?

Share this post


Link to post
Share on other sites
renman29    675
Just an update. I added this function:


//--------------------------------------------------------------
// C O N V E R T T O F U L L S C R E E N C O O R D I N A T E
//--------------------------------------------------------------
void ConvertToFullScreenCoordinate(LONG &x, LONG &y) {
LONG width,height;
float w,h;
RECT rect;
GetWindowRect(g_hwnd, &rect);
width=rect.right-rect.left;
height=rect.bottom-rect.top;
w=(float)g_width/(float)width;
h=(float)g_height/(float)height;
x=(LONG)(w*(float)x); y=(LONG)(h*(float)y);
}


It seems to work ok for a single pixel so far...
I'm still not so sure if this is the best way to handle this. Any ideas or feedback are more than welcome.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this