Jump to content
  • Advertisement
Sign in to follow this  
sprinter_trueno

HALFTONE not working ?

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi there, I am doing some picture viewer thing and need HALFTONE for my device context to make sure the picture does not look ruined after resizing. Yet, even though ppl seem to use it without problem everywhere, I do not get it working even though it seemingly couldn't be easier. The below is the code I use in the OnPaint() function: /* Change the stretch mode */ int iOld = dc.SetStretchBltMode(HALFTONE); SetBrushOrgEx(dc.m_hDC, 0,0, NULL); /* Draw the picture into the context */ picPict.Show( &dcBackBuffer, rcPictDisp.left, rcPictDisp.top, rcPictDisp.right - rcPictDisp.left, rcPictDisp.bottom - rcPictDisp.top ); /* Change back */ dc.SetStretchBltMode(iOld); What could be the cause of this ? Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
it seems you are setting the stretchblt mode on a variabled called 'dc'

but you are drawing to somthing called dcBackbuffer, are you sure they are using the same DC?

Share this post


Link to post
Share on other sites
Sorry,

code was wrong, yet still does not work:

/* Picture loaded */
if (bPictLoaded)
{
/* Change the stretch mode */
int iOld = dcBackBuffer.SetStretchBltMode(HALFTONE);

SetBrushOrgEx(dcBackBuffer.m_hDC, 0,0, NULL);

/* Draw the picture*/
picPict.Show( &dcBackBuffer, rcPictDisp.left, rcPictDisp.top,
rcPictDisp.right - rcPictDisp.left,
rcPictDisp.bottom - rcPictDisp.top );

/* Change back */
dcBackBuffer.SetStretchBltMode(iOld);
}


/* Note: All blitting done now */

/* Blit into the client context in one go */
dc.BitBlt( NULL, NULL, szFrame.cx, szFrame.cy,
&dcBackBuffer,
NULL, NULL,
SRCCOPY );

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!