Sign in to follow this  

HALFTONE not working ?

This topic is 4306 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
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

This topic is 4306 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.

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