开发者

Can't Create Monochrome Bitmap from HBITMAP got by GDI+ Bitmap::GetHBITMAP

开发者 https://www.devze.com 2023-02-02 04:38 出处:网络
I am unable to Create a Monochrome Mask for a 24BPP Colour image with SetBkColor() > BitBlt[SRCCOPY]. The Mask ends up completely Black. The entire thing works only if I use LoadImage() instead to get

I am unable to Create a Monochrome Mask for a 24BPP Colour image with SetBkColor() > BitBlt[SRCCOPY]. The Mask ends up completely Black. The entire thing works only if I use LoadImage() instead to get the HBITMAP.

Bitmap img(L"Ball.bmp");
HBITMAP hBM;
img.GetHBITMAP(Color::White, &hBM);
//hBM = LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_BALL));
.
.
SelectObject(hDCSrc, hBM);
SetBkColor(RGB(0xFF, 0xFF, oxFF));
BitBlt(hDCMem, 0, 0, img.GetWidth(), img.GetHeight(), hDCSrc, 0, 0, SRCCOPY);

//hDCMem is copletely black; but OK when using LoadImage() instead

Other people with the same problem have suggested using Graphics::GetHDC and doing the required with this DC as a workaround. But why does it开发者_如何学Go not work as it should.

Even this workaround din' work. Please help :(


Solved it: How to genrate a monochrome bit mask for a 32bit bitmap

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号