X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cf694132f1c28509a9f84377ce8d374bae4177ad..1afc06c2d8c945535175bf32e427aac0bbb704de:/utils/wxPython/src/image.i?ds=inline diff --git a/utils/wxPython/src/image.i b/utils/wxPython/src/image.i index 0674cb8e22..ae84b468bb 100644 --- a/utils/wxPython/src/image.i +++ b/utils/wxPython/src/image.i @@ -85,6 +85,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 +102,27 @@ public: int GetWidth(); int GetHeight(); - unsigned char *GetData(); - void SetData( unsigned char *data ); + //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 */ ; + } + dataPtr = (unsigned char*)PyString_AsString(data); + self->SetData(dataPtr); + } + } void SetMaskColour( unsigned char r, unsigned char g, unsigned char b ); unsigned char GetMaskRed();