it is possible to put alpha in the icon instead of using a mask, but I
don't have time to figure that out today.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34476
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
- wxMask *mask = bmp.GetMask();
+ wxMask* mask;
+ wxBitmap newbmp;
+ if ( bmp.HasAlpha() )
+ {
+ // Convert alpha to a mask. NOTE: It would be better to actually put
+ // the alpha into the icon instead of making a mask, but I don't have
+ // time to figure that out today.
+ wxImage img = bmp.ConvertToImage();
+ img.ConvertAlphaToMask();
+ newbmp = wxBitmap(img);
+ mask = newbmp.GetMask();
+ }
+ else
+ {
+ mask = bmp.GetMask();
+ }
+
if ( !mask )
{
// we must have a mask for an icon, so even if it's probably incorrect,
if ( !mask )
{
// we must have a mask for an icon, so even if it's probably incorrect,
HICON hicon = ::CreateIconIndirect(&iconInfo);
HICON hicon = ::CreateIconIndirect(&iconInfo);
+ if ( !bmp.GetMask() && !bmp.HasAlpha() )
{
// we created the mask, now delete it
delete mask;
{
// we created the mask, now delete it
delete mask;