threshold is pixel value, it should use unsigned char
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28843 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -209,7 +209,7 @@ public:
|
|||||||
|
|
||||||
// converts image's alpha channel to mask, if it has any, does nothing
|
// converts image's alpha channel to mask, if it has any, does nothing
|
||||||
// otherwise:
|
// otherwise:
|
||||||
bool ConvertAlphaToMask(unsigned threshold = 128);
|
bool ConvertAlphaToMask(unsigned char threshold = 128);
|
||||||
|
|
||||||
static bool CanRead( const wxString& name );
|
static bool CanRead( const wxString& name );
|
||||||
static int GetImageCount( const wxString& name, long type = wxBITMAP_TYPE_ANY );
|
static int GetImageCount( const wxString& name, long type = wxBITMAP_TYPE_ANY );
|
||||||
|
@@ -936,7 +936,7 @@ bool wxImage::SetMaskFromImage(const wxImage& mask,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxImage::ConvertAlphaToMask(unsigned threshold)
|
bool wxImage::ConvertAlphaToMask(unsigned char threshold)
|
||||||
{
|
{
|
||||||
if (!HasAlpha())
|
if (!HasAlpha())
|
||||||
return true;
|
return true;
|
||||||
@@ -954,12 +954,12 @@ bool wxImage::ConvertAlphaToMask(unsigned threshold)
|
|||||||
unsigned char *imgdata = GetData();
|
unsigned char *imgdata = GetData();
|
||||||
unsigned char *alphadata = GetAlpha();
|
unsigned char *alphadata = GetAlpha();
|
||||||
|
|
||||||
size_t w = GetWidth();
|
int w = GetWidth();
|
||||||
size_t h = GetHeight();
|
int h = GetHeight();
|
||||||
|
|
||||||
for (size_t y = 0; y < h; y++)
|
for (int y = 0; y < h; y++)
|
||||||
{
|
{
|
||||||
for (size_t x = 0; x < w; x++, imgdata += 3, alphadata++)
|
for (int x = 0; x < w; x++, imgdata += 3, alphadata++)
|
||||||
{
|
{
|
||||||
if ((unsigned)(*alphadata) < threshold)
|
if ((unsigned)(*alphadata) < threshold)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user