Jump to content
  • Advertisement
Sign in to follow this  

HALFTONE not working ?

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!