X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/be43ef045a3bc040da1173d526d95347e7902216..588066b7a39629e44bb39f1ab436b80f38c13f33:/wxPython/src/_image.i diff --git a/wxPython/src/_image.i b/wxPython/src/_image.i index 57ab53657f..7c3ea50467 100644 --- a/wxPython/src/_image.i +++ b/wxPython/src/_image.i @@ -84,7 +84,7 @@ public: %name(ImageFromStream) wxImage(wxInputStream& stream, long type = wxBITMAP_TYPE_ANY, int index = -1); %name(ImageFromStreamMime) wxImage(wxInputStream& stream, const wxString& mimetype, int index = -1 ); %extend { - %name(EmptyImage) wxImage(int width=0, int height=0, bool clear = True) { + %name(EmptyImage) wxImage(int width=0, int height=0, bool clear = true) { if (width > 0 && height > 0) return new wxImage(width, height, clear); else @@ -104,7 +104,7 @@ public: return NULL; } memcpy(copy, data, width*height*3); - return new wxImage(width, height, copy, False); + return new wxImage(width, height, copy, false); } } @@ -134,7 +134,19 @@ public: values than startR, startG, startB. Returns a tuple consisting of a success flag and rgb values.", ""); + + DocDeclStr( + bool , ConvertAlphaToMask(byte threshold = 128), + "If the image has alpha channel, this method converts it to mask. All pixels +with alpha value less than ``threshold`` are replaced with mask colour and the +alpha channel is removed. Mask colour is chosen automatically using +`FindFirstUnusedColour`. + +If the image image doesn't have alpha channel, ConvertAlphaToMask does +nothing.", ""); + + // Set image's mask to the area of 'mask' that has colour bool SetMaskFromImage(const wxImage & mask, byte mr, byte mg, byte mb); @@ -188,7 +200,8 @@ success flag and rgb values.", ""); unsigned char* dataPtr; if (! PyString_Check(data)) { - PyErr_SetString(PyExc_TypeError, "Expected string object"); + wxPyBLOCK_THREADS(PyErr_SetString(PyExc_TypeError, + "Expected string object")); return /* NULL */ ; } @@ -284,13 +297,13 @@ success flag and rgb values.", ""); unsigned char GetMaskRed(); unsigned char GetMaskGreen(); unsigned char GetMaskBlue(); - void SetMask( bool mask = True ); + void SetMask( bool mask = true ); bool HasMask(); wxImage Rotate(double angle, const wxPoint & centre_of_rotation, - bool interpolating = True, wxPoint * offset_after_rotation = NULL) const ; - wxImage Rotate90( bool clockwise = True ) ; - wxImage Mirror( bool horizontally = True ) ; + bool interpolating = true, wxPoint * offset_after_rotation = NULL) const ; + wxImage Rotate90( bool clockwise = true ) ; + wxImage Mirror( bool horizontally = true ) ; void Replace( unsigned char r1, unsigned char g1, unsigned char b1, unsigned char r2, unsigned char g2, unsigned char b2 ); @@ -317,8 +330,8 @@ MustHaveApp(ConvertToBitmap); MustHaveApp(ConvertToMonoBitmap); %extend { - wxBitmap ConvertToBitmap() { - wxBitmap bitmap(*self); + wxBitmap ConvertToBitmap(int depth=-1) { + wxBitmap bitmap(*self, depth); return bitmap; } @@ -479,7 +492,7 @@ public: DocStr( Quantize, "Reduce the colours in the source image and put the result into the -destination image, setting the palette in the detination if +destination image, setting the palette in the destination if needed. Both images may be the same, to overwrite the source image.", " :todo: Create a version that returns the wx.Palette used.");