How to use StrecthBlt?
C / C++ / MFC
2
Posts
2
Posters
0
Views
1
Watching
-
Can anyone post a quick sample code on how to use StrecthBlt? I have a bitmap that I want to resize to its half-size. Thanks a lot in advance.
-
Can anyone post a quick sample code on how to use StrecthBlt? I have a bitmap that I want to resize to its half-size. Thanks a lot in advance.
assume your image is in m_bmp, and pDC is a window DC. CDC memDC = CreateCompatibleDC(pDC); CBitmap *pOldMemBmp = memDC.SelectObject(&m_bmp); pDC->StretchBlt(outX, outY, bmpWidth / 2, bmpHeight / 2, &memDC, 0, 0, bmpWidth, bmpHeight, SRCCOPY); memDC.SelectObject(pOldMemBmp); -- if you don't know bmpWidth and bmpHeight : BITMAP bm; m_bmp.GetObject(sizeof(BITMAP), &bm); bmpWidth = bm.bmWidth; bmpHeight = bm.bmHeight; -c