I managed to achieve double buffering using GDI, but not with GDI +. I would like to display a png image without making it flicker. In addition, at some point I would also like to achieve animation with png images using GDI +, so knowing how to double the buffer with GDI + is mandatory.
I managed to get the png image into the Image object via ISTREAM: here is the part of my code that will help you understand where I am having problems:
memmove(pBlock,pImage, size); CreateStreamOnHGlobal(hBlock, FALSE, &pStream); Graphics graphics(memDC); Image image(pStream); int image_width; int image_height; image_width= image.GetWidth(); image_height=image.GetHeight(); graphics.DrawImage(&image, posX,posY, image_width, image_height); BitBlt(hdc, 0, 0, image_width, image_height, memDC, 0, 0, SRCCOPY);
Note. If I draw a png image directly on the DC (hdc) screen, it displays a fine. However, when I try to first draw an image in memDC and then blt that memDC on the DC screen, the image does not appear!
Can someone point me in the right direction, how should someone double the buffer using GDI plus? thank you
source share