Hello everyone. I would like to know if it is possible to double buffer a .png image using GDI+ Can anyone help me? Below is the code I used to display a png image with alpha transparency, however, I do not know how to double buffer it! Please help.
DrawPng (HDC hdc, HINSTANCE hinstance, HWND hwnd, int curbitmapvalue, int posX, int posY)
{ HRSRC hRsrc;
hRsrc = FindResource(hinstance, MAKEINTRESOURCE(curbitmapvalue), "PNG");
HGLOBAL hImage;
hImage = LoadResource(hinstance, hRsrc);
LPVOID pImage;
pImage = LockResource(hImage);
HGLOBAL hBlock;
IStream *pStream=NULL;
int size= SizeofResource(hinstance, hRsrc);
hBlock=GlobalAlloc(GHND, size);
LPVOID pBlock;
pBlock = GlobalLock(hBlock);
memmove(pBlock,pImage, size);
CreateStreamOnHGlobal(hBlock, FALSE, &pStream);
Graphics graphics(hdc);
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);
pStream->Release();
GlobalUnlock(hBlock);
GlobalFree(hBlock);
}