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:
@@ -527,13 +527,18 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight,
|
|||||||
return bmp;
|
return bmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxBitmap::CreateFromImage( const wxImage& image, int depth )
|
bool wxBitmap::CreateFromImage( const wxImage& img, int depth )
|
||||||
{
|
{
|
||||||
UnRef();
|
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") )
|
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 width = image.GetWidth();
|
||||||
int height = image.GetHeight();
|
int height = image.GetHeight();
|
||||||
|
|
||||||
|
@@ -527,13 +527,18 @@ wxBitmap wxBitmap::Rescale( int clipx, int clipy, int clipwidth, int clipheight,
|
|||||||
return bmp;
|
return bmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxBitmap::CreateFromImage( const wxImage& image, int depth )
|
bool wxBitmap::CreateFromImage( const wxImage& img, int depth )
|
||||||
{
|
{
|
||||||
UnRef();
|
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") )
|
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 width = image.GetWidth();
|
||||||
int height = image.GetHeight();
|
int height = image.GetHeight();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user