diff --git a/src/gtk/bitmap.cpp b/src/gtk/bitmap.cpp index de3d7c1f67..2cb613a8fe 100644 --- a/src/gtk/bitmap.cpp +++ b/src/gtk/bitmap.cpp @@ -527,13 +527,18 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight, return bmp; } -bool wxBitmap::CreateFromImage( const wxImage& image, int depth ) +bool wxBitmap::CreateFromImage( const wxImage& img, int depth ) { UnRef(); - wxCHECK_MSG( image.Ok(), FALSE, wxT("invalid image") ) + wxCHECK_MSG( img.Ok(), FALSE, wxT("invalid image") ) wxCHECK_MSG( depth == -1 || depth == 1, FALSE, wxT("invalid bitmap depth") ) + // NB: wxGTK doesn't yet support alpha channel in bitmaps. The best we can + // do is to convert alpha channel to mask, if it is present: + wxImage image(img); + image.ConvertAlphaToMask(); + int width = image.GetWidth(); int height = image.GetHeight(); diff --git a/src/gtk1/bitmap.cpp b/src/gtk1/bitmap.cpp index de3d7c1f67..2cb613a8fe 100644 --- a/src/gtk1/bitmap.cpp +++ b/src/gtk1/bitmap.cpp @@ -527,13 +527,18 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight, return bmp; } -bool wxBitmap::CreateFromImage( const wxImage& image, int depth ) +bool wxBitmap::CreateFromImage( const wxImage& img, int depth ) { UnRef(); - wxCHECK_MSG( image.Ok(), FALSE, wxT("invalid image") ) + wxCHECK_MSG( img.Ok(), FALSE, wxT("invalid image") ) wxCHECK_MSG( depth == -1 || depth == 1, FALSE, wxT("invalid bitmap depth") ) + // NB: wxGTK doesn't yet support alpha channel in bitmaps. The best we can + // do is to convert alpha channel to mask, if it is present: + wxImage image(img); + image.ConvertAlphaToMask(); + int width = image.GetWidth(); int height = image.GetHeight();