I notice ICONINFO
contains two bitmap. If I understand correctrly, hbmMask
is for the icon's outline which at the same time specifies which part should be transparent, and hbmColor
is for the icon's actual color HBITMAP
.
So My question is, why the hbmMask
is necessary? Why not just put the alpha channel's information inside hbmColor
? Is it able to combine them into a single bitmap?
Besides, Gdiplus::Bitmap
has a constructor which accepts a HICON . Does it mean this GDI+ bitmap is able to handle alpha channel information?
Thanks:)
why the hbmMask is necessary? Why not just put the alpha channel's information inside hbmColor?
An alpha channel is only possible for 32 bpp bitmaps (8 bit alpha channel, 8 bit red, green and blue channels each). Icons with 1 to 8 bpp bitmaps therefore have to store the transparency information separately from the color bitmap in the hbmMask
bitmap.
Actually, even 32 bpp bitmaps that have an alpha channel, are required to include the hbmMask
, unless the PNG format is used . In the latter case, the mask is derived automatically from the alpha channel.
Besides, Gdiplus::Bitmap has a constructor which accepts a HICON . Does it mean this GDI+ bitmap is able to handle alpha channel information?
As the documentation doesn't state otherwise, you are safe to assume that the constructor converts a 32 bpp HICON
into a 32 bpp bitmap. A GDI+ bitmap certainly is able to store an alpha channel if the pixel format is appropriate (in the case of an icon PixelFormat32bppARGB
is required).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.