i blit hdc other hdc, , hdc blit hdc containing "beginpaint". problem appears, nothing have been drawn.
this code, thanks,
hdc hdcmem3 = createcompatibledc(null); selectobject(hdcmem3, picture); bitmap bitmap; getobject(picture, sizeof(bitmap), &bitmap); hdc hdcmem2 = createcompatibledc(null); bitblt(hdcmem2, 0, 0, bitmap.bmwidth, bitmap.bmheight, hdcmem3, 0, 0, srccopy); deletedc(hdcmem3); bitblt(hdcmem, 0, 0, bitmap.bmwidth, bitmap.bmheight, hdcmem2, 0, 0, srccopy); deletedc(hdcmem2);
createcompatibledc
creates device context 1-pixel monochrome bitmap.
in example, device context referenced hdcmem3
has real bitmap, dc referenced hdcmem2
has 1-pixel monochrome bitmap. when blit hdcmem3
hdcmem2
, end 1 black pixel.
what need create memory bitmap select hdcmem2
. assume that, eventually, you're going display in window. let's assume have device context window called hdcwindow
.
// create memory bitmap that's compatible window (screen) , // same size picture. hbmpmem2 = createcompatiblebitmap(hdcwindow, bitmap.bmwidth, bitmap.bmheight); hbmpold2 = selectobject(hdcmem2, hbmpmem2);
now when stuff hdcmem2, draw real bitmap.
when you're done hdcmem2
, need first take care of hbmpmem2
:
selectobject(hdcmem2, hbmpold2); deleteobject(hbmpmem2); destroydc(hdcmem2);
Comments
Post a Comment