Memory BMP Mode
1. Initialize
gdiplus::bitmap* pbitmap = new Gdiplus::bitmap (w,h);
gdiplus::graphics* pgraphics = Gdiplus::graphics::fromimage (pbitmap);
Pgraphics->setsmoothingmode (gdiplus::smoothingmodehighquality);
Pgraphics->setinterpolationmode (gdiplus::interpolationmodehighqualitybicubic);
HDC hdc = GetDC (hWnd);
gdiplus::graphics* Pgraphicswnd = new Gdiplus::graphics (HDC);
2. Draw pgraphics-> in memory BMP
3. Draw the memory BMP to the window DC
pgraphicswnd->drawimage (Pbitmap, x0, y0, width, height) ;
4. Release
Gdiplus::D llexports::gdipfree (pgraphics);
Gdiplus::D llexports::gdipfree (pbitmap);
Gdiplus::D llexports::gdipfree (Pgraphicswnd);
BitBlt Way
1. Initialize
hdc hdc = GetDC (hWnd);
HDC hdcmemory = CreateCompatibleDC (hdc);
Hbitmap hbitmap = CreateCompatibleBitmap (hdc, W, h);
Hbitmap Holdbitmap = (hbitmap) SelectObject (hdcmemory, hbitmap);
gdiplus::graphics* pgraphics = new Gdiplus::graphics (hdcmemory);
Pgraphics->setsmoothingmode (gdiplus::smoothingmodehighquality);
Pgraphics->setinterpolationmode (gdiplus::interpolationmodehighqualitybicubic);
2. Draw pgraphics-> into the memory
DC
3. Copy the contents of the memory DC to the window DC
StretchBlt (hdc, 0, 0, W, H, hdcmemory, 0, 0, W, h, srccopy);
4. Release
Gdiplus::D llexports::gdipfree (pgraphics);
DeleteObject (HOLDBITMAP);
DeleteObject (HBITMAP);
DeleteObject (hdcmemory);