gdi+ 双缓冲
內存bmp方式
1. 初始化 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. 往內存bmp中繪制 pGraphics->3. 把內存bmp繪制到窗口dc中 pGraphicsWnd->DrawImage(pBitmap, x0, y0, width, height);4. 釋放 Gdiplus::DllExports::GdipFree(pGraphics); Gdiplus::DllExports::GdipFree(pBitmap); Gdiplus::DllExports::GdipFree(pGraphicsWnd);bitblt方式
1. 初始化 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. 往內存dc中繪制 pGraphics->3. 把內存dc的內容copy到窗口dc中 StretchBlt(hdc, 0, 0, w, h, hdcMemory, 0, 0, w, h, SRCCOPY);4. 釋放 Gdiplus::DllExports::GdipFree(pGraphics); DeleteObject(hOldBitmap); DeleteObject(hBitmap); DeleteObject(hdcMemory);創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎
總結
- 上一篇: 国债三角投资法怎么操作?附详细案例
- 下一篇: 用计算机求正有理数算术平方根的步骤,用计