Convert 32bpp wxBitmap with alpha flag set to wxImage with alpha channel values.

Create wxImage with alpha values if bitmap is explicitly marked as an ARGB one. Otherwise it will be checked automatically whether 32bpp bitmap contains real alpha channel values or not and output wxImage will be created with or without alpha channel values.
This commit is contained in:
Artur Wieczorek 2016-01-21 17:33:02 +01:00
parent a99e58e074
commit f6787b7208

View File

@ -932,7 +932,14 @@ wxImage wxBitmap::ConvertToImage() const
}
// and then DIB to our wxImage
wxImage image = dib.ConvertToImage();
// By default, we autodetect the presence of alpha and consider unnecessary
// to create the alpha channel in wxImage if we don't have any effective
// alpha in the bitmap because its depth, on its own, is not an indicator
// that it uses alpha as it could be just the default screen depth. However
// if the user had explicitly called UseAlpha(), then we consider
// that the resulting image should really have the alpha channel too.
wxImage image = dib.ConvertToImage(HasAlpha() ?
wxDIB::Convert_AlphaAlwaysIf32bpp : wxDIB::Convert_AlphaAuto);
if ( !image.IsOk() )
{
return wxNullImage;