]> git.saurik.com Git - wxWidgets.git/blobdiff - utils/wxPython/src/image.i
new wxMenu stuff and thread implementations
[wxWidgets.git] / utils / wxPython / src / image.i
index 039a5d9cc968d65dc605ede35f2c5ccdfe9f1193..acb2f14e08138e6dd2899dbb601e9d3888165169 100644 (file)
@@ -110,6 +110,8 @@ public:
     int GetWidth();
     int GetHeight();
 
+    wxImage GetSubImage(const wxRect& rect);
+
     //unsigned char *GetData();
     //void SetData( unsigned char *data );
 
@@ -127,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);
         }
     }