X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1dc2f8658b885eb1d3514bba87c24830f0e9b034..dafb483b3a1f273e79bae8cbc7eb0bab2387239b:/utils/wxPython/src/image.i diff --git a/utils/wxPython/src/image.i b/utils/wxPython/src/image.i index ae84b468bb..acb2f14e08 100644 --- a/utils/wxPython/src/image.i +++ b/utils/wxPython/src/image.i @@ -32,7 +32,7 @@ class wxImageHandler { public: - wxImageHandler(); + // wxImageHandler(); Abstract Base Class wxString GetName(); wxString GetExtension(); long GetType(); @@ -72,7 +72,15 @@ public: wxGIFHandler(); }; +class wxPNMHandler : public wxImageHandler { +public: + wxPNMHandler(); +}; +class wxPCXHandler : public wxImageHandler { +public: + wxPCXHandler(); +}; //--------------------------------------------------------------------------- @@ -102,6 +110,8 @@ public: int GetWidth(); int GetHeight(); + wxImage GetSubImage(const wxRect& rect); + //unsigned char *GetData(); //void SetData( unsigned char *data ); @@ -119,7 +129,10 @@ public: PyErr_SetString(PyExc_TypeError, "Expected string object"); return /* NULL */ ; } - dataPtr = (unsigned char*)PyString_AsString(data); + + size_t len = self->GetWidth() * self->GetHeight() * 3; + dataPtr = new unsigned char[len]; + memcpy(dataPtr, PyString_AsString(data), len); self->SetData(dataPtr); } } @@ -164,9 +177,7 @@ void wxImage_AddHandler(wxImageHandler *handler); } %} +void wxInitAllImageHandlers(); + //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - - - -