X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/dd9f7fea29e3f8bb61861f52984b7943512346ac..9176f38f730c3415ac7a911c2f85cdea7eca4478:/wxPython/src/_image.i diff --git a/wxPython/src/_image.i b/wxPython/src/_image.i index cdf9ecebb8..f5d4b36bd3 100644 --- a/wxPython/src/_image.i +++ b/wxPython/src/_image.i @@ -83,14 +83,24 @@ public: %name(ImageFromMime) wxImage(const wxString& name, const wxString& mimetype, int index = -1); %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 { + + %nokwargs wxImage(int width=0, int height=0, bool clear = True); + %nokwargs wxImage(const wxSize& size, 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 return new wxImage; } - + %name(EmptyImage) wxImage(const wxSize& size, bool clear = True) { + return new wxImage(size.x, size.y, clear); + } + + %name(ImageFromBitmap) wxImage(const wxBitmap &bitmap) { return new wxImage(bitmap.ConvertToImage()); } @@ -161,6 +171,13 @@ public: int GetWidth(); int GetHeight(); + %extend { + wxSize GetSize() { + wxSize size(self->GetWidth(), self->GetHeight()); + return size; + } + } + wxImage GetSubImage(const wxRect& rect); wxImage Copy(); void Paste( const wxImage &image, int x, int y ); @@ -204,7 +221,7 @@ public: unsigned char* buffer; int size; - wxPyBeginBlockThreads(); + bool blocked = wxPyBeginBlockThreads(); if (!PyArg_Parse(data, "t#", &buffer, &size)) goto done; @@ -214,7 +231,7 @@ public: } self->SetData(buffer); done: - wxPyEndBlockThreads(); + wxPyEndBlockThreads(blocked); } @@ -258,7 +275,7 @@ public: unsigned char* buffer; int size; - wxPyBeginBlockThreads(); + bool blocked = wxPyBeginBlockThreads(); if (!PyArg_Parse(data, "t#", &buffer, &size)) goto done; @@ -268,7 +285,7 @@ public: } self->SetAlpha(buffer); done: - wxPyEndBlockThreads(); + wxPyEndBlockThreads(blocked); } }