X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/96bfd05319f9e393843e84ca5274d85ff248bad4..4649b5eded522cdc6d76aae074f98a2c162fd648:/wxPython/src/image.i?ds=sidebyside diff --git a/wxPython/src/image.i b/wxPython/src/image.i index e6d5614a7c..37757eeb54 100644 --- a/wxPython/src/image.i +++ b/wxPython/src/image.i @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------- -class wxImageHandler { +class wxImageHandler : public wxObject { public: // wxImageHandler(); Abstract Base Class wxString GetName(); @@ -90,12 +90,15 @@ public: //--------------------------------------------------------------------------- -class wxImage { +class wxImage : public wxObject { public: wxImage( const wxString& name, long type = wxBITMAP_TYPE_ANY ); ~wxImage(); wxBitmap ConvertToBitmap(); +#ifdef __WXGTK__ + wxBitmap ConvertToMonoBitmap( unsigned char red, unsigned char green, unsigned char blue ) const; +#endif void Create( int width, int height ); void Destroy(); wxImage Scale( int width, int height ); @@ -169,18 +172,17 @@ public: static bool RemoveHandler( const wxString& name ); }; + // Alternate constructors -%new wxImage* wxNullImage(); -%new wxImage* wxEmptyImage(int width, int height); +%new wxImage* wxEmptyImage(int width=0, int height=0); %new wxImage* wxImageFromMime(const wxString& name, const wxString& mimetype); %new wxImage* wxImageFromBitmap(const wxBitmap &bitmap); %{ - wxImage* wxNullImage() { - return new wxImage; - } - - wxImage* wxEmptyImage(int width, int height) { - return new wxImage(width, height); + wxImage* wxEmptyImage(int width=0, int height=0) { + if (width == 0 && height == 0) + return new wxImage; + else + return new wxImage(width, height); } wxImage* wxImageFromMime(const wxString& name, const wxString& mimetype) { @@ -192,8 +194,34 @@ public: } %} - void wxInitAllImageHandlers(); + +%readonly +%{ +#if 0 +%} + +extern wxImage wxNullImage; + +%readwrite +%{ +#endif +%} + + + //--------------------------------------------------------------------------- +// This one is here to avoid circular imports + +%new wxBitmap* wxBitmapFromImage(const wxImage& img, int depth=-1); + +%{ + wxBitmap* wxBitmapFromImage(const wxImage& img, int depth=-1) { + return new wxBitmap(img, depth); + } + +%} + + //---------------------------------------------------------------------------