Does Gdiplus::Bitmap::FromHICON handle “black and white icon” properly?

丶灬走出姿态 提交于 2019-12-12 04:04:52

问题


As stated in MSDN ICONINFO, depending on whether the structure defines a black and white icon, the hbmMask and hbmColor are formatted differently.

hbmMask

Type: HBITMAP

The icon bitmask bitmap. If this structure defines a black and white icon, this bitmask is formatted so that the upper half is the icon AND bitmask and the lower half is the icon XOR bitmask. Under this condition, the height should be an even multiple of two. If this structure defines a color icon, this mask only defines the AND bitmask of the icon.

This means we need to detect the existences of hbmColor to properly calculate the icon's height.

However, I later notice Gdiplus::Bitmap::FromHICON(), which accepts a HICON and converts it to a Gdiplus::Bitmap.

Since I don't see any material mentioning about the "black and white" icon in GDI+, does this method has taken care of this situation internally?

(Unfortunately, I don't have a handy icon for testing. I'm not sure how to create a proper test case either.)

来源:https://stackoverflow.com/questions/45867852/does-gdiplusbitmapfromhicon-handle-black-and-white-icon-properly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!