fixed wxImage->wxBitmap conversion for images with alpha channel

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28811 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2004-08-16 12:31:42 +00:00
parent ff5ad79411
commit a29b55cdf6
2 changed files with 14 additions and 4 deletions

View File

@@ -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();