]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/_image.i
Added a note to self to look at adding ProvidesBackground in the future
[wxWidgets.git] / wxPython / src / _image.i
index 3d216f9a8eb24bc0fc2b09a4910ac4bf87279c8e..ea4cca9f1000ff7473102c9519f58840b511b1d4 100644 (file)
@@ -106,6 +106,24 @@ public:
             memcpy(copy, data, width*height*3);
             return new wxImage(width, height, copy, false);
         }
+        %name(ImageFromDataWithAlpha) wxImage(int width, int height,
+                                              unsigned char* data, unsigned char* alpha) {
+            // Copy the source data so the wxImage can clean it up later
+            unsigned char* dcopy = (unsigned char*)malloc(width*height*3);
+            if (dcopy == NULL) {
+                PyErr_NoMemory();
+                return NULL;
+            }
+            memcpy(dcopy, data, width*height*3);
+            unsigned char* acopy = (unsigned char*)malloc(width*height);
+            if (acopy == NULL) {
+                PyErr_NoMemory();
+                return NULL;
+            }
+            memcpy(acopy, alpha, width*height);
+            
+            return new wxImage(width, height, dcopy, acopy, false);
+        }
     }
 
     void Create( int width, int height );