1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
void Draw_Test_Image_to_New_Position(HDC hdc, RECT* prc)
{
// hdcWorkingBackBuffer is a back buffer to blt to.
//HBITMAP is An object handle that manages bitmap data.
HBITMAP hbmBuffer = CreateCompatibleBitmap(hdc_MainWindow, prc->right, prc->bottom);
SelectObject(hdcWorkingBackBuffer, hbmBuffer);
DeleteObject(hbmBuffer);
// This puts the animation in place. EACH TIME.
// This creates a buffer for the animation bitmap to be blitted from.
HDC hdcAnimationBuffer_001 = CreateCompatibleDC(hdc_MainWindow);
// BitBlt the mask of the image to hdcWorkingBackBuffer .
SelectObject(hdcAnimationBuffer_001, Moving_Test_Image_MASK);
BitBlt(hdcWorkingBackBuffer, TestImage_Info.x, TestImage_Info.y, TestImage_Info.width, TestImage_Info.height, hdcAnimationBuffer_001, 0, 0, SRCAND);
// BitBlt the color image of the image to hdcWorkingBackBuffer .
SelectObject(hdcAnimationBuffer_001, Moving_Test_Image);
BitBlt(hdcWorkingBackBuffer, TestImage_Info.x, TestImage_Info.y, TestImage_Info.width, TestImage_Info.height, hdcAnimationBuffer_001, 0, 0, SRCPAINT);
// This blits the working (composted) buffer (hdcWorkingBackBuffer) to the front (screen) buffer.
BitBlt(hdc_MainWindow, 0, 0, prc->right, prc->bottom, hdcWorkingBackBuffer, 0, 0, SRCCOPY);
DeleteDC(hdcAnimationBuffer_001);
}
|