]> git.saurik.com Git - wxWidgets.git/commitdiff
Changed wxImage::ConvertAlphaToMask() return type to bool.
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 2 Nov 2010 11:57:09 +0000 (11:57 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 2 Nov 2010 11:57:09 +0000 (11:57 +0000)
Make this function more useful by returning true from it if alpha channel was
really converted to the mask by it.

Closes #12637.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65990 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
include/wx/image.h
interface/wx/image.h
src/common/image.cpp

index 69bb9a4e1e8ddd59df9eb07edd61ca9e383899cd..795d6871ff5bb2031e3053213d850ef57d957ffc 100644 (file)
@@ -426,6 +426,7 @@ All (GUI):
 - Improve wxGTK print/page setup dialog (rafravago).
 - Added wxToolbook XRC handler (Andrea Zanellato).
 - Added wxDocManager::FindTemplate() (troelsk).
+- Return bool, not void, from wxImage::ConvertAlphaToMask() (troelsk).
 
 MSW:
 
index cb602383d1f7badf2440795cf2ab2ecbaf958f46..b17ebe06a560b5a24e8658d92ce0ad789d11d842 100644 (file)
@@ -388,7 +388,7 @@ public:
     // automatically or using the specified colour for the mask), if it has
     // any, does nothing otherwise:
     bool ConvertAlphaToMask(unsigned char threshold = wxIMAGE_ALPHA_THRESHOLD);
-    void ConvertAlphaToMask(unsigned char mr, unsigned char mg, unsigned char mb,
+    bool ConvertAlphaToMask(unsigned char mr, unsigned char mg, unsigned char mb,
                             unsigned char threshold = wxIMAGE_ALPHA_THRESHOLD);
 
 
index c14f9f95954468719e2bc3382e21a7dd828f3ad8..b083796d72434ae5719689c26732d057983ffb06 100644 (file)
@@ -815,7 +815,7 @@ public:
         FindFirstUnusedColour() by this function, see the overload below if you
         this is not appropriate.
 
-        @return @false if FindFirstUnusedColour returns @false, @true otherwise.
+        @return Returns @true on success, @false on error.
     */
     bool ConvertAlphaToMask(unsigned char threshold = wxIMAGE_ALPHA_THRESHOLD);
 
@@ -841,8 +841,9 @@ public:
             are set. Pixels with the alpha values above the threshold are
             considered to be opaque.
 
+        @return Returns @true on success, @false on error.
      */
-    void ConvertAlphaToMask(unsigned char mr, unsigned char mg, unsigned char mb,
+    bool ConvertAlphaToMask(unsigned char mr, unsigned char mg, unsigned char mb,
                             unsigned char threshold = wxIMAGE_ALPHA_THRESHOLD);
 
     /**
index 75f950842b7e6149caaa88618f131b16cfeb395f..4a070120399248e236e5c61f3cca4cc028a1251a 100644 (file)
@@ -2020,7 +2020,7 @@ bool wxImage::SetMaskFromImage(const wxImage& mask,
 bool wxImage::ConvertAlphaToMask(unsigned char threshold)
 {
     if ( !HasAlpha() )
-        return true;
+        return false;
 
     unsigned char mr, mg, mb;
     if ( !FindFirstUnusedColour(&mr, &mg, &mb) )
@@ -2029,17 +2029,16 @@ bool wxImage::ConvertAlphaToMask(unsigned char threshold)
         return false;
     }
 
-    ConvertAlphaToMask(mr, mg, mb, threshold);
-    return true;
+    return ConvertAlphaToMask(mr, mg, mb, threshold);
 }
 
-void wxImage::ConvertAlphaToMask(unsigned char mr,
+bool wxImage::ConvertAlphaToMask(unsigned char mr,
                                  unsigned char mg,
                                  unsigned char mb,
                                  unsigned char threshold)
 {
     if ( !HasAlpha() )
-        return;
+        return false;
 
     AllocExclusive();
 
@@ -2070,6 +2069,8 @@ void wxImage::ConvertAlphaToMask(unsigned char mr,
 
     M_IMGDATA->m_alpha = NULL;
     M_IMGDATA->m_staticAlpha = false;
+
+    return true;
 }
 
 // ----------------------------------------------------------------------------