-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTransparentBlt2.cpp
More file actions
42 lines (29 loc) · 1.35 KB
/
Copy pathTransparentBlt2.cpp
File metadata and controls
42 lines (29 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
void CGraphicTestDlg::TransparentBlt2(int nX0 , int nY0)
{
HBITMAP bitMan=(HBITMAP)LoadImage(AfxGetInstanceHandle(),"./c00000.bmp",IMAGE_BITMAP,0,0,LR_LOADFROMFILE|LR_CREATEDIBSECTION);
HBITMAP bitManDealed=CreateCompatibleBitmap(pClientDC->m_hDC,22,42);
HBITMAP bitMask=CreateBitmap(22,42,1,1,NULL);
HDC hdcMan=CreateCompatibleDC(pClientDC->m_hDC);
HDC hdcManDealed=CreateCompatibleDC(pClientDC->m_hDC);
HDC hdcMask=CreateCompatibleDC(pClientDC->m_hDC);
HBITMAP bitOldMan=(HBITMAP)SelectObject(hdcMan,bitMan);
HBITMAP bitOldManDealed=(HBITMAP)SelectObject(hdcManDealed,bitManDealed);
HBITMAP bitOldMask=(HBITMAP)SelectObject(hdcMask,bitMask);
BitBlt(hdcManDealed,0,0,22,42,hdcMan,0,0,SRCCOPY);
SetBkColor(hdcManDealed,RGB(255,0,0));
BitBlt(hdcMask,0,0,22,42,hdcManDealed,0,0,SRCCOPY);
SetBkColor(hdcManDealed,RGB(0,0,0));
SetTextColor(hdcManDealed,RGB(255,255,255));
BitBlt(hdcManDealed,0,0,22,42,hdcMask,0,0,SRCAND);
BitBlt(pClientDC->m_hDC,nX0,nY0,22,42,hdcMask,0,0,SRCAND);
BitBlt(pClientDC->m_hDC,nX0,nY0,22,42,hdcManDealed,0,0,SRCPAINT);
SelectObject(hdcMan,bitOldMan);
DeleteObject(bitMan);
DeleteDC(hdcMan);
SelectObject(hdcManDealed,bitOldManDealed);
DeleteObject(bitManDealed);
DeleteDC(hdcManDealed);
SelectObject(hdcMask,bitOldMask);
DeleteObject(bitMask);
DeleteDC(hdcMask);
}