- HBITMAP hBitmap1 = (HBITMAP) bitmap.GetHBITMAP();
- HBITMAP hBitmap2 = 0;
- if ( mask.Ok() )
- hBitmap2 = (HBITMAP) mask.GetHBITMAP();
- else if (bitmap.GetMask())
- hBitmap2 = (HBITMAP) bitmap.GetMask()->GetMaskBitmap();
-
- HBITMAP hBitmapI=0;
- if(hBitmap2!=0) {
- // Microsoft imagelist masks are inverted from wxWindows mask standard (white is mask color)
- BITMAP bm;
- ::GetObject(hBitmap2,sizeof(BITMAP),(LPVOID)&bm);
- int w=bm.bmWidth;
- int h=bm.bmHeight;
- HDC hdc = ::CreateCompatibleDC(NULL);
- HDC hdci = ::CreateCompatibleDC(NULL);
- hBitmapI = ::CreateCompatibleBitmap(hdci, w, h);
- ::SelectObject(hdc, hBitmap2);
- ::SelectObject(hdci, hBitmapI);
- ::BitBlt(hdci, 0, 0, w, h, hdc, 0, 0, NOTSRCCOPY);
- ::DeleteDC(hdc);
- ::DeleteDC(hdci);
- }