#pragma comment (lib, "Msimg32.lib")
BOOL DrawPicture(HDC hDC, LPRECT lpRect)
{
HDC hMemDC;
HBITMAP hBitmapOld;
BITMAP bm;
if (s_hBitmap == NULL || lpRect == NULL)
return FALSE;
GetObject(s_hBitmap, sizeof(BITMAP), &bm);
hMemDC = CreateCompatibleDC(hDC);
hBitmapOld = (HBITMAP)SelectObject(hMemDC, s_hBitmap);
BLENDFUNCTION bf;
bf.BlendOp = AC_SRC_OVER;
bf.BlendFlags = 0;
bf.SourceConstantAlpha = 0xFF;
bf.AlphaFormat = AC_SRC_ALPHA;
AlphaBlend(hDC,
lpRect->left,
lpRect->top,
lpRect->right - lpRect->left,
lpRect->bottom - lpRect->top,
hMemDC, 0, 0, bm.bmWidth, bm.bmHeight, bf);
SelectObject(hMemDC, hBitmapOld);
DeleteDC(hMemDC);
return TRUE;
}
Sunday, October 11, 2009
Win32 API: Рисуем 32-битную картинку
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment