From 8f2b21e474d7f7c07fd97306d2f6d5b1f05d2844 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Sat, 21 Aug 2004 11:54:31 +0000 Subject: [PATCH] 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 --- include/wx/image.h | 2 +- src/common/image.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/wx/image.h b/include/wx/image.h index f39648b4d7..153065c764 100644 --- a/include/wx/image.h +++ b/include/wx/image.h @@ -209,7 +209,7 @@ public: // converts image's alpha channel to mask, if it has any, does nothing // otherwise: - bool ConvertAlphaToMask(unsigned threshold = 128); + bool ConvertAlphaToMask(unsigned char threshold = 128); static bool CanRead( const wxString& name ); static int GetImageCount( const wxString& name, long type = wxBITMAP_TYPE_ANY ); diff --git a/src/common/image.cpp b/src/common/image.cpp index a01eece6e5..b55fd18070 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -936,7 +936,7 @@ bool wxImage::SetMaskFromImage(const wxImage& mask, return true; } -bool wxImage::ConvertAlphaToMask(unsigned threshold) +bool wxImage::ConvertAlphaToMask(unsigned char threshold) { if (!HasAlpha()) return true; @@ -954,12 +954,12 @@ bool wxImage::ConvertAlphaToMask(unsigned threshold) unsigned char *imgdata = GetData(); unsigned char *alphadata = GetAlpha(); - size_t w = GetWidth(); - size_t h = GetHeight(); + int w = GetWidth(); + 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) { -- 2.45.2