-
- // NOTE: We need the junk parameter so the compiler will be able
- // differentiate from the two functions above. It isn't used for
- // anything else.
- %RenameDocCtor(
- _ImageFromBuffer, ":see: `wx.ImageFromBuffer`", "",
- wxImage(int width, int height, buffer data, int DATASIZE, PyObject* junk))
- {
- wxUnusedVar(junk);
- if (DATASIZE != width*height*3) {
- wxPyErr_SetString(PyExc_ValueError, "Invalid data buffer size.");
- return NULL;
- }
- return new wxImage(width, height, data, true);
- }
-
- %RenameDocCtor(
- _ImageFromBufferWithAlpha, ":see: `wx.ImageFromBuffer`", "",
- wxImage(int width, int height, buffer data, int DATASIZE, buffer alpha, int ALPHASIZE, PyObject* junk))
- {
- wxUnusedVar(junk);
- 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;
- }
- return new wxImage(width, height, data, alpha, true);
- }