]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/image.i
Updated note about wxSTC using wxPopupWindow
[wxWidgets.git] / wxPython / src / image.i
index 837336efe8260a83ec98cef172a2b370a4b989e1..84d1c7c5f0a59180e04e926fc0c29779e159b286 100644 (file)
@@ -167,6 +167,12 @@ public:
     //void SetData( unsigned char *data );
 
     %addmethods {
+        PyObject* GetDataBuffer() {
+            unsigned char* data = self->GetData();
+            int len = self->GetWidth() * self->GetHeight() * 3;
+            return PyBuffer_FromReadWriteMemory(data, len);
+        }
+
         PyObject* GetData() {
             unsigned char* data = self->GetData();
             int len = self->GetWidth() * self->GetHeight() * 3;
@@ -185,6 +191,7 @@ public:
             dataPtr = (unsigned char*) malloc(len);
             memcpy(dataPtr, PyString_AsString(data), len);
             self->SetData(dataPtr);
+            // wxImage takes ownership of dataPtr...
         }
     }