diff --git a/wxPython/src/image.i b/wxPython/src/image.i index 84d1c7c5f0..7f125f11bc 100644 --- a/wxPython/src/image.i +++ b/wxPython/src/image.i @@ -179,6 +179,21 @@ public: return PyString_FromStringAndSize((char*)data, len); } + void SetDataBuffer(PyObject* data) { + unsigned char* buffer; + int size; + + if (!PyArg_Parse(data, "w#", &buffer, &size)) + return; + + if (size != self->GetWidth() * self->GetHeight() * 3) { + PyErr_SetString(PyExc_TypeError, "Incorrect buffer size"); + return; + } + + self->SetData(buffer); + } + void SetData(PyObject* data) { unsigned char* dataPtr;