+
+
+ %RenameDocCtor(
+ ImageFromDataWithAlpha,
+ "Construct an Image from a buffer of RGB bytes with an Alpha channel.
+Accepts either a string or a buffer object holding the data and the
+length of the data must be width*height*3.", "",
+ wxImage(int width, int height, buffer data, int DATASIZE, buffer alpha, int ALPHASIZE))
+ {
+ if (DATASIZE != width*height*3) {
+ wxPyErr_SetString(PyExc_ValueError, "Invalid data buffer size.");
+ return NULL;
+ }
+ if (ALPHASIZE != width*height) {
+ wxPyErr_SetString(PyExc_ValueError, "Invalid alpha buffer size.");
+ return NULL;
+ }
+
+ // Copy the source data so the wxImage can clean it up later
+ buffer dcopy = (buffer)malloc(DATASIZE);
+ if (dcopy == NULL) {
+ wxPyBLOCK_THREADS(PyErr_NoMemory());
+ return NULL;
+ }
+ memcpy(dcopy, data, DATASIZE);