Using Bitmap with the overload of the constructor that takes an HICON Bitmap::Bitmap(hicon) Creates a Bitmap object based on an icon. Bitmap( HICON hicon ); Parameters hicon [in] Handle to a GDI icon. i know GDI+ has plenty of support for alpha transparency. Is this just a shortcoming of the implementation? i cannot imagine there's any technical reason for it, but there's no other good enough excuse. Why does GDI+ not support alpha channel in icons? Is there any accepted workaround? i would mutliply the alpha, but you have no pixel access to a bitmap that is actually an HICON.
"Ian Boyd" wrote in message news:#im#OLP7IHA.1196@TK2MSFTNGP05.phx.gbl... > Using Bitmap with the overload of the constructor that takes an HICON > > Bitmap::Bitmap(hicon) > Creates a Bitmap object based on an icon. > > Bitmap( > HICON hicon > ); > > Parameters > hicon > [in] Handle to a GDI icon. > > > i know GDI+ has plenty of support for alpha transparency. Is this just a > shortcoming of the implementation? i cannot imagine there's any technical > reason for it, but there's no other good enough excuse. > > > Why does GDI+ not support alpha channel in icons? I didn't know icons could have alpha channel data. You could create a 32bpp ARGB bitmap of the appropriate dimensions, create a Graphics from the bitmap, clear the bitmap to transparent, and draw the icon on the Graphics object. At that point you'd have a Bitmap with alpha-channel data. Mark -- Mark Salsbery Microsoft MVP - Visual C++ > > > Is there any accepted workaround? i would mutliply the alpha, but you have > no pixel access to a bitmap that is actually an HICON. >
Mark Salsbery [MVP] wrote: > "Ian Boyd" wrote in message > news:#im#OLP7IHA.1196@TK2MSFTNGP05.phx.gbl... >> Using Bitmap with the overload of the constructor that takes an HICON >> >> Bitmap::Bitmap(hicon) >> Creates a Bitmap object based on an icon. >> >> Bitmap( >> HICON hicon >> ); >> >> Parameters >> hicon >> [in] Handle to a GDI icon. >> >> >> i know GDI+ has plenty of support for alpha transparency. Is this just >> a shortcoming of the implementation? i cannot imagine there's any >> technical reason for it, but there's no other good enough excuse. >> >> >> Why does GDI+ not support alpha channel in icons? > > > I didn't know icons could have alpha channel data. All the XP style icons have a "32bit" version which VS6 shows as having a thick black shadow which I assume is the alpha channel. -- Dean Earley (dean.earley@icode.co.uk) i-Catcher Development Team iCode Systems
"Dean Earley" wrote in message news:#PmrDEa7IHA.5440@TK2MSFTNGP02.phx.gbl... > Mark Salsbery [MVP] wrote: >> "Ian Boyd" wrote in message >> news:#im#OLP7IHA.1196@TK2MSFTNGP05.phx.gbl... >>> Using Bitmap with the overload of the constructor that takes an HICON >>> >>> Bitmap::Bitmap(hicon) >>> Creates a Bitmap object based on an icon. >>> >>> Bitmap( >>> HICON hicon >>> ); >>> >>> Parameters >>> hicon >>> [in] Handle to a GDI icon. >>> >>> >>> i know GDI+ has plenty of support for alpha transparency. Is this just a >>> shortcoming of the implementation? i cannot imagine there's any >>> technical reason for it, but there's no other good enough excuse. >>> >>> >>> Why does GDI+ not support alpha channel in icons? >> >> >> I didn't know icons could have alpha channel data. > > All the XP style icons have a "32bit" version which VS6 shows as having a > thick black shadow which I assume is the alpha channel. *smacking forehead* Duh - now I remember why I use 3rd party software for icon creation....because the dev environment doesn't work with them. I'm an idiot :-) Thanks Dean! Mark -- Mark Salsbery Microsoft MVP - Visual C++ > > -- > Dean Earley (dean.earley@icode.co.uk) > i-Catcher Development Team > > iCode Systems
> You could create a 32bpp ARGB bitmap of the appropriate dimensions, create > a Graphics from the bitmap, clear the bitmap to transparent, and draw the > icon on the Graphics object. > At that point you'd have a Bitmap with alpha-channel data. Twenty-odd hours of work, most of that spent discovering the bug in http://support.microsoft.com/kb/318876 only to be thwarted by the fact that GDI+ doesn't support 32bpp ARGB HBITMAPS. Ugh. My original question still stands: Why does GDI+ not support alpha channel in icons? Although the answer is becoming more apparent to me, i still would have though the point of GDI+ was to support things like transparency.