X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cf694132f1c28509a9f84377ce8d374bae4177ad..85bc0351f76f6d3f00460a167fc108b900e0725c:/utils/wxPython/src/image.i diff --git a/utils/wxPython/src/image.i b/utils/wxPython/src/image.i index 0674cb8e22..d6095c7a52 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,6 +72,20 @@ public: wxGIFHandler(); }; +class wxPNMHandler : public wxImageHandler { +public: + wxPNMHandler(); +}; + +class wxPCXHandler : public wxImageHandler { +public: + wxPCXHandler(); +}; + +class wxTIFFHandler : public wxImageHandler { +public: + wxTIFFHandler(); +}; //--------------------------------------------------------------------------- @@ -85,6 +99,7 @@ public: void Create( int width, int height ); void Destroy(); wxImage Scale( int width, int height ); + void Rescale(int width, int height); void SetRGB( int x, int y, unsigned char r, unsigned char g, unsigned char b ); unsigned char GetRed( int x, int y ); @@ -101,8 +116,32 @@ public: int GetWidth(); int GetHeight(); - unsigned char *GetData(); - void SetData( unsigned char *data ); + wxImage GetSubImage(const wxRect& rect); + + //unsigned char *GetData(); + //void SetData( unsigned char *data ); + + %addmethods { + PyObject* GetData() { + unsigned char* data = self->GetData(); + int len = self->GetWidth() * self->GetHeight() * 3; + return PyString_FromStringAndSize((char*)data, len); + } + + void SetData(PyObject* data) { + unsigned char* dataPtr; + + if (! PyString_Check(data)) { + PyErr_SetString(PyExc_TypeError, "Expected string object"); + return /* NULL */ ; + } + + size_t len = self->GetWidth() * self->GetHeight() * 3; + dataPtr = new unsigned char[len]; + memcpy(dataPtr, PyString_AsString(data), len); + self->SetData(dataPtr); + } + } void SetMaskColour( unsigned char r, unsigned char g, unsigned char b ); unsigned char GetMaskRed(); @@ -144,9 +183,7 @@ void wxImage_AddHandler(wxImageHandler *handler); } %} +void wxInitAllImageHandlers(); + //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- - - - -