[ 1502016 ] wxImage::ConvertToGreyscale should retain alpha channel.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39621 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
9061c15cee
commit
7ce30d0b41
@ -866,6 +866,16 @@ wxImage wxImage::ConvertToGreyscale( double lr, double lg, double lb ) const
|
||||
}
|
||||
}
|
||||
|
||||
// copy the alpha channel, if any
|
||||
if (HasAlpha())
|
||||
{
|
||||
const size_t alphaSize = GetWidth() * GetHeight();
|
||||
unsigned char *alpha = (unsigned char*)malloc(alphaSize);
|
||||
memcpy(alpha, GetAlpha(), alphaSize);
|
||||
image.InitAlpha();
|
||||
image.SetAlpha(alpha);
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user