reSWIGged

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40916 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2006-08-29 19:26:06 +00:00
parent 8989034ec9
commit eec1c382d0
12 changed files with 168 additions and 237 deletions

View File

@@ -275,10 +275,6 @@ ID_ZOOM_OUT = _core_.ID_ZOOM_OUT
ID_UNDELETE = _core_.ID_UNDELETE ID_UNDELETE = _core_.ID_UNDELETE
ID_REVERT_TO_SAVED = _core_.ID_REVERT_TO_SAVED ID_REVERT_TO_SAVED = _core_.ID_REVERT_TO_SAVED
ID_HIGHEST = _core_.ID_HIGHEST ID_HIGHEST = _core_.ID_HIGHEST
ACCEL_ALT = _core_.ACCEL_ALT
ACCEL_CTRL = _core_.ACCEL_CTRL
ACCEL_SHIFT = _core_.ACCEL_SHIFT
ACCEL_NORMAL = _core_.ACCEL_NORMAL
PD_AUTO_HIDE = _core_.PD_AUTO_HIDE PD_AUTO_HIDE = _core_.PD_AUTO_HIDE
PD_APP_MODAL = _core_.PD_APP_MODAL PD_APP_MODAL = _core_.PD_APP_MODAL
PD_CAN_ABORT = _core_.PD_CAN_ABORT PD_CAN_ABORT = _core_.PD_CAN_ABORT
@@ -3070,12 +3066,11 @@ def _ImageFromBuffer(*args, **kwargs):
def ImageFromBuffer(width, height, dataBuffer, alphaBuffer=None): def ImageFromBuffer(width, height, dataBuffer, alphaBuffer=None):
""" """
Creates a `wx.Image` from the data in dataBuffer. The dataBuffer Creates a `wx.Image` from the data in dataBuffer. The dataBuffer
parameter must be a Python object that implements the buffer interface, or parameter must be a Python object that implements the buffer interface,
is convertable to a buffer object, such as a string, array, etc. The such as a string, array, etc. The dataBuffer object is expected to
dataBuffer object is expected to contain a series of RGB bytes and be contain a series of RGB bytes and be width*height*3 bytes long. A buffer
width*height*3 bytes long. A buffer object can optionally be supplied for object can optionally be supplied for the image's alpha channel data, and
the image's alpha channel data, and it is expected to be width*height it is expected to be width*height bytes long.
bytes long.
The wx.Image will be created with its data and alpha pointers initialized The wx.Image will be created with its data and alpha pointers initialized
to the memory address pointed to by the buffer objects, thus saving the to the memory address pointed to by the buffer objects, thus saving the
@@ -3093,10 +3088,6 @@ def ImageFromBuffer(width, height, dataBuffer, alphaBuffer=None):
the objects used for the data and alpha buffers in a way that would cause the objects used for the data and alpha buffers in a way that would cause
them to change size. them to change size.
""" """
if not isinstance(dataBuffer, buffer):
dataBuffer = buffer(dataBuffer)
if alphaBuffer is not None and not isinstance(alphaBuffer, buffer):
alphaBuffer = buffer(alphaBuffer)
image = _core_._ImageFromBuffer(width, height, dataBuffer, alphaBuffer) image = _core_._ImageFromBuffer(width, height, dataBuffer, alphaBuffer)
image._buffer = dataBuffer image._buffer = dataBuffer
image._alpha = alphaBuffer image._alpha = alphaBuffer
@@ -7461,6 +7452,11 @@ _core_.EventLoopActivator_swigregister(EventLoopActivator)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
ACCEL_ALT = _core_.ACCEL_ALT
ACCEL_CTRL = _core_.ACCEL_CTRL
ACCEL_SHIFT = _core_.ACCEL_SHIFT
ACCEL_NORMAL = _core_.ACCEL_NORMAL
ACCEL_CMD = _core_.ACCEL_CMD
class AcceleratorEntry(object): class AcceleratorEntry(object):
""" """
A class used to define items in an `wx.AcceleratorTable`. wxPython A class used to define items in an `wx.AcceleratorTable`. wxPython

View File

@@ -13430,9 +13430,7 @@ SWIGINTERN PyObject *_wrap_new_ImageFromData(PyObject *SWIGUNUSEDPARM(self), PyO
} }
arg2 = static_cast< int >(val2); arg2 = static_cast< int >(val2);
{ {
if (obj2 != Py_None) { if (PyObject_AsReadBuffer(obj2, (const void**)(&arg3), &arg4) == -1) SWIG_fail;
if (!PyArg_Parse(obj2, "t#", &arg3, &arg4)) SWIG_fail;
}
} }
{ {
PyThreadState* __tstate = wxPyBeginAllowThreads(); PyThreadState* __tstate = wxPyBeginAllowThreads();
@@ -13480,13 +13478,11 @@ SWIGINTERN PyObject *_wrap_new_ImageFromDataWithAlpha(PyObject *SWIGUNUSEDPARM(s
} }
arg2 = static_cast< int >(val2); arg2 = static_cast< int >(val2);
{ {
if (obj2 != Py_None) { if (PyObject_AsReadBuffer(obj2, (const void**)(&arg3), &arg4) == -1) SWIG_fail;
if (!PyArg_Parse(obj2, "t#", &arg3, &arg4)) SWIG_fail;
}
} }
{ {
if (obj3 != Py_None) { if (obj3 != Py_None) {
if (!PyArg_Parse(obj3, "t#", &arg5, &arg6)) SWIG_fail; if (PyObject_AsReadBuffer(obj3, (const void**)(&arg5), &arg6) == -1) SWIG_fail;
} }
} }
{ {
@@ -15509,9 +15505,7 @@ SWIGINTERN PyObject *_wrap_Image_SetData(PyObject *SWIGUNUSEDPARM(self), PyObjec
} }
arg1 = reinterpret_cast< wxImage * >(argp1); arg1 = reinterpret_cast< wxImage * >(argp1);
{ {
if (obj1 != Py_None) { if (PyObject_AsReadBuffer(obj1, (const void**)(&arg2), &arg3) == -1) SWIG_fail;
if (!PyArg_Parse(obj1, "t#", &arg2, &arg3)) SWIG_fail;
}
} }
{ {
PyThreadState* __tstate = wxPyBeginAllowThreads(); PyThreadState* __tstate = wxPyBeginAllowThreads();
@@ -15574,9 +15568,7 @@ SWIGINTERN PyObject *_wrap_Image_SetDataBuffer(PyObject *SWIGUNUSEDPARM(self), P
} }
arg1 = reinterpret_cast< wxImage * >(argp1); arg1 = reinterpret_cast< wxImage * >(argp1);
{ {
if (obj1 != Py_None) { if (PyObject_AsReadBuffer(obj1, (const void**)(&arg2), &arg3) == -1) SWIG_fail;
if (!PyArg_Parse(obj1, "t#", &arg2, &arg3)) SWIG_fail;
}
} }
{ {
PyThreadState* __tstate = wxPyBeginAllowThreads(); PyThreadState* __tstate = wxPyBeginAllowThreads();
@@ -15640,7 +15632,7 @@ SWIGINTERN PyObject *_wrap_Image_SetAlphaData(PyObject *SWIGUNUSEDPARM(self), Py
arg1 = reinterpret_cast< wxImage * >(argp1); arg1 = reinterpret_cast< wxImage * >(argp1);
{ {
if (obj1 != Py_None) { if (obj1 != Py_None) {
if (!PyArg_Parse(obj1, "t#", &arg2, &arg3)) SWIG_fail; if (PyObject_AsReadBuffer(obj1, (const void**)(&arg2), &arg3) == -1) SWIG_fail;
} }
} }
{ {
@@ -15705,7 +15697,7 @@ SWIGINTERN PyObject *_wrap_Image_SetAlphaBuffer(PyObject *SWIGUNUSEDPARM(self),
arg1 = reinterpret_cast< wxImage * >(argp1); arg1 = reinterpret_cast< wxImage * >(argp1);
{ {
if (obj1 != Py_None) { if (obj1 != Py_None) {
if (!PyArg_Parse(obj1, "t#", &arg2, &arg3)) SWIG_fail; if (PyObject_AsReadBuffer(obj1, (const void**)(&arg2), &arg3) == -1) SWIG_fail;
} }
} }
{ {
@@ -17082,14 +17074,12 @@ SWIGINTERN PyObject *_wrap__ImageFromBuffer(PyObject *SWIGUNUSEDPARM(self), PyOb
} }
arg2 = static_cast< int >(val2); arg2 = static_cast< int >(val2);
{ {
if (obj2 != Py_None) { if (PyObject_AsReadBuffer(obj2, (const void**)(&arg3), &arg4) == -1) SWIG_fail;
if (!PyArg_Parse(obj2, "t#", &arg3, &arg4)) SWIG_fail;
}
} }
if (obj3) { if (obj3) {
{ {
if (obj3 != Py_None) { if (obj3 != Py_None) {
if (!PyArg_Parse(obj3, "t#", &arg5, &arg6)) SWIG_fail; if (PyObject_AsReadBuffer(obj3, (const void**)(&arg5), &arg6) == -1) SWIG_fail;
} }
} }
} }
@@ -56284,10 +56274,6 @@ SWIGEXPORT void SWIG_init(void) {
SWIG_Python_SetConstant(d, "ID_UNDELETE",SWIG_From_int(static_cast< int >(wxID_UNDELETE))); SWIG_Python_SetConstant(d, "ID_UNDELETE",SWIG_From_int(static_cast< int >(wxID_UNDELETE)));
SWIG_Python_SetConstant(d, "ID_REVERT_TO_SAVED",SWIG_From_int(static_cast< int >(wxID_REVERT_TO_SAVED))); SWIG_Python_SetConstant(d, "ID_REVERT_TO_SAVED",SWIG_From_int(static_cast< int >(wxID_REVERT_TO_SAVED)));
SWIG_Python_SetConstant(d, "ID_HIGHEST",SWIG_From_int(static_cast< int >(wxID_HIGHEST))); SWIG_Python_SetConstant(d, "ID_HIGHEST",SWIG_From_int(static_cast< int >(wxID_HIGHEST)));
SWIG_Python_SetConstant(d, "ACCEL_ALT",SWIG_From_int(static_cast< int >(wxACCEL_ALT)));
SWIG_Python_SetConstant(d, "ACCEL_CTRL",SWIG_From_int(static_cast< int >(wxACCEL_CTRL)));
SWIG_Python_SetConstant(d, "ACCEL_SHIFT",SWIG_From_int(static_cast< int >(wxACCEL_SHIFT)));
SWIG_Python_SetConstant(d, "ACCEL_NORMAL",SWIG_From_int(static_cast< int >(wxACCEL_NORMAL)));
SWIG_Python_SetConstant(d, "PD_AUTO_HIDE",SWIG_From_int(static_cast< int >(wxPD_AUTO_HIDE))); SWIG_Python_SetConstant(d, "PD_AUTO_HIDE",SWIG_From_int(static_cast< int >(wxPD_AUTO_HIDE)));
SWIG_Python_SetConstant(d, "PD_APP_MODAL",SWIG_From_int(static_cast< int >(wxPD_APP_MODAL))); SWIG_Python_SetConstant(d, "PD_APP_MODAL",SWIG_From_int(static_cast< int >(wxPD_APP_MODAL)));
SWIG_Python_SetConstant(d, "PD_CAN_ABORT",SWIG_From_int(static_cast< int >(wxPD_CAN_ABORT))); SWIG_Python_SetConstant(d, "PD_CAN_ABORT",SWIG_From_int(static_cast< int >(wxPD_CAN_ABORT)));
@@ -56936,6 +56922,11 @@ SWIGEXPORT void SWIG_init(void) {
SWIG_Python_SetConstant(d, "PYAPP_ASSERT_LOG",SWIG_From_int(static_cast< int >(wxPYAPP_ASSERT_LOG))); SWIG_Python_SetConstant(d, "PYAPP_ASSERT_LOG",SWIG_From_int(static_cast< int >(wxPYAPP_ASSERT_LOG)));
SWIG_Python_SetConstant(d, "PRINT_WINDOWS",SWIG_From_int(static_cast< int >(wxPRINT_WINDOWS))); SWIG_Python_SetConstant(d, "PRINT_WINDOWS",SWIG_From_int(static_cast< int >(wxPRINT_WINDOWS)));
SWIG_Python_SetConstant(d, "PRINT_POSTSCRIPT",SWIG_From_int(static_cast< int >(wxPRINT_POSTSCRIPT))); SWIG_Python_SetConstant(d, "PRINT_POSTSCRIPT",SWIG_From_int(static_cast< int >(wxPRINT_POSTSCRIPT)));
SWIG_Python_SetConstant(d, "ACCEL_ALT",SWIG_From_int(static_cast< int >(wxACCEL_ALT)));
SWIG_Python_SetConstant(d, "ACCEL_CTRL",SWIG_From_int(static_cast< int >(wxACCEL_CTRL)));
SWIG_Python_SetConstant(d, "ACCEL_SHIFT",SWIG_From_int(static_cast< int >(wxACCEL_SHIFT)));
SWIG_Python_SetConstant(d, "ACCEL_NORMAL",SWIG_From_int(static_cast< int >(wxACCEL_NORMAL)));
SWIG_Python_SetConstant(d, "ACCEL_CMD",SWIG_From_int(static_cast< int >(wxACCEL_CMD)));
SWIG_addvarlink(SWIG_globals(),(char*)"NullAcceleratorTable",NullAcceleratorTable_get, NullAcceleratorTable_set); SWIG_addvarlink(SWIG_globals(),(char*)"NullAcceleratorTable",NullAcceleratorTable_get, NullAcceleratorTable_set);
SWIG_addvarlink(SWIG_globals(),(char*)"PanelNameStr",PanelNameStr_get, PanelNameStr_set); SWIG_addvarlink(SWIG_globals(),(char*)"PanelNameStr",PanelNameStr_get, PanelNameStr_set);
SWIG_Python_SetConstant(d, "WINDOW_VARIANT_NORMAL",SWIG_From_int(static_cast< int >(wxWINDOW_VARIANT_NORMAL))); SWIG_Python_SetConstant(d, "WINDOW_VARIANT_NORMAL",SWIG_From_int(static_cast< int >(wxWINDOW_VARIANT_NORMAL)));

View File

@@ -724,29 +724,26 @@ def _BitmapFromBuffer(*args, **kwargs):
def BitmapFromBuffer(width, height, dataBuffer, alphaBuffer=None): def BitmapFromBuffer(width, height, dataBuffer, alphaBuffer=None):
""" """
Creates a `wx.Bitmap` from the data in dataBuffer. The dataBuffer Creates a `wx.Bitmap` from the data in dataBuffer. The dataBuffer
parameter must be a Python object that implements the buffer interface, or parameter must be a Python object that implements the buffer
is convertable to a buffer object, such as a string, array, etc. The interface, such as a string, array, etc. The dataBuffer object is
dataBuffer object is expected to contain a series of RGB bytes and be expected to contain a series of RGB bytes and be width*height*3
width*height*3 bytes long. A buffer object can optionally be supplied for bytes long. A buffer object can optionally be supplied for the
the image's alpha channel data, and it is expected to be width*height image's alpha channel data, and it is expected to be width*height
bytes long. On Windows the RGB values are 'premultiplied' by the alpha bytes long. On Windows the RGB values are 'premultiplied' by the
values. (The other platforms appear to already be premultiplying the alpha values. (The other platforms do the multiplication
alpha.) themselves.)
Unlike `wx.ImageFromBuffer` the bitmap created with this function does not Unlike `wx.ImageFromBuffer` the bitmap created with this function
share the memory buffer with the buffer object. This is because the does not share the memory buffer with the buffer object. This is
native pixel buffer format varies on different platforms, and so instead because the native pixel buffer format varies on different
an efficient as possible copy of the data is made from the buffer objects platforms, and so instead an efficient as possible copy of the
to the bitmap's native pixel buffer. For direct access to a bitmap's data is made from the buffer objects to the bitmap's native pixel
pixel buffer see `wx.NativePixelData` and `wx.AlphaPixelData`. buffer. For direct access to a bitmap's pixel buffer see
`wx.NativePixelData` and `wx.AlphaPixelData`.
:see: `wx.Bitmap`, `wx.BitmapFromBufferRGBA`, `wx.NativePixelData`, :see: `wx.Bitmap`, `wx.BitmapFromBufferRGBA`, `wx.NativePixelData`,
`wx.AlphaPixelData`, `wx.ImageFromBuffer` `wx.AlphaPixelData`, `wx.ImageFromBuffer`
""" """
if not isinstance(dataBuffer, buffer):
dataBuffer = buffer(dataBuffer)
if alphaBuffer is not None and not isinstance(alphaBuffer, buffer):
alphaBuffer = buffer(alphaBuffer)
if alphaBuffer is not None: if alphaBuffer is not None:
return _gdi_._BitmapFromBufferAlpha(width, height, dataBuffer, alphaBuffer) return _gdi_._BitmapFromBufferAlpha(width, height, dataBuffer, alphaBuffer)
else: else:
@@ -759,25 +756,24 @@ def _BitmapFromBufferRGBA(*args, **kwargs):
def BitmapFromBufferRGBA(width, height, dataBuffer): def BitmapFromBufferRGBA(width, height, dataBuffer):
""" """
Creates a `wx.Bitmap` from the data in dataBuffer. The dataBuffer Creates a `wx.Bitmap` from the data in dataBuffer. The dataBuffer
parameter must be a Python object that implements the buffer interface, or parameter must be a Python object that implements the buffer
is convertable to a buffer object, such as a string, array, etc. The interface, such as a string, array, etc. The dataBuffer object is
dataBuffer object is expected to contain a series of RGBA bytes (red, expected to contain a series of RGBA bytes (red, green, blue and
green, blue and alpha) and be width*height*4 bytes long. On Windows the alpha) and be width*height*4 bytes long. On Windows the RGB
RGB values are 'premultiplied' by the alpha values. (The other platforms values are 'premultiplied' by the alpha values. (The other
appear to already be premultiplying the alpha.) platforms do the multiplication themselves.)
Unlike `wx.ImageFromBuffer` the bitmap created with this function does not Unlike `wx.ImageFromBuffer` the bitmap created with this function
share the memory buffer with the buffer object. This is because the does not share the memory buffer with the buffer object. This is
native pixel buffer format varies on different platforms, and so instead because the native pixel buffer format varies on different
an efficient as possible copy of the data is made from the buffer object platforms, and so instead an efficient as possible copy of the
to the bitmap's native pixel buffer. For direct access to a bitmap's data is made from the buffer object to the bitmap's native pixel
pixel buffer see `wx.NativePixelData` and `wx.AlphaPixelData`. buffer. For direct access to a bitmap's pixel buffer see
`wx.NativePixelData` and `wx.AlphaPixelData`.
:see: `wx.Bitmap`, `wx.BitmapFromBuffer`, `wx.NativePixelData`, :see: `wx.Bitmap`, `wx.BitmapFromBuffer`, `wx.NativePixelData`,
`wx.AlphaPixelData`, `wx.ImageFromBuffer` `wx.AlphaPixelData`, `wx.ImageFromBuffer`
""" """
if not isinstance(dataBuffer, buffer):
dataBuffer = buffer(dataBuffer)
return _gdi_._BitmapFromBufferRGBA(width, height, dataBuffer) return _gdi_._BitmapFromBufferRGBA(width, height, dataBuffer)
class PixelDataBase(object): class PixelDataBase(object):

View File

@@ -6680,13 +6680,11 @@ SWIGINTERN PyObject *_wrap__BitmapFromBufferAlpha(PyObject *SWIGUNUSEDPARM(self)
} }
arg2 = static_cast< int >(val2); arg2 = static_cast< int >(val2);
{ {
if (obj2 != Py_None) { if (PyObject_AsReadBuffer(obj2, (const void**)(&arg3), &arg4) == -1) SWIG_fail;
if (!PyArg_Parse(obj2, "t#", &arg3, &arg4)) SWIG_fail;
}
} }
{ {
if (obj3 != Py_None) { if (obj3 != Py_None) {
if (!PyArg_Parse(obj3, "t#", &arg5, &arg6)) SWIG_fail; if (PyObject_AsReadBuffer(obj3, (const void**)(&arg5), &arg6) == -1) SWIG_fail;
} }
} }
{ {
@@ -6730,9 +6728,7 @@ SWIGINTERN PyObject *_wrap__BitmapFromBuffer(PyObject *SWIGUNUSEDPARM(self), PyO
} }
arg2 = static_cast< int >(val2); arg2 = static_cast< int >(val2);
{ {
if (obj2 != Py_None) { if (PyObject_AsReadBuffer(obj2, (const void**)(&arg3), &arg4) == -1) SWIG_fail;
if (!PyArg_Parse(obj2, "t#", &arg3, &arg4)) SWIG_fail;
}
} }
{ {
result = (wxBitmap *)_BitmapFromBuffer(arg1,arg2,arg3,arg4); result = (wxBitmap *)_BitmapFromBuffer(arg1,arg2,arg3,arg4);
@@ -6775,9 +6771,7 @@ SWIGINTERN PyObject *_wrap__BitmapFromBufferRGBA(PyObject *SWIGUNUSEDPARM(self),
} }
arg2 = static_cast< int >(val2); arg2 = static_cast< int >(val2);
{ {
if (obj2 != Py_None) { if (PyObject_AsReadBuffer(obj2, (const void**)(&arg3), &arg4) == -1) SWIG_fail;
if (!PyArg_Parse(obj2, "t#", &arg3, &arg4)) SWIG_fail;
}
} }
{ {
result = (wxBitmap *)_BitmapFromBufferRGBA(arg1,arg2,arg3,arg4); result = (wxBitmap *)_BitmapFromBufferRGBA(arg1,arg2,arg3,arg4);

View File

@@ -275,10 +275,6 @@ ID_ZOOM_OUT = _core_.ID_ZOOM_OUT
ID_UNDELETE = _core_.ID_UNDELETE ID_UNDELETE = _core_.ID_UNDELETE
ID_REVERT_TO_SAVED = _core_.ID_REVERT_TO_SAVED ID_REVERT_TO_SAVED = _core_.ID_REVERT_TO_SAVED
ID_HIGHEST = _core_.ID_HIGHEST ID_HIGHEST = _core_.ID_HIGHEST
ACCEL_ALT = _core_.ACCEL_ALT
ACCEL_CTRL = _core_.ACCEL_CTRL
ACCEL_SHIFT = _core_.ACCEL_SHIFT
ACCEL_NORMAL = _core_.ACCEL_NORMAL
PD_AUTO_HIDE = _core_.PD_AUTO_HIDE PD_AUTO_HIDE = _core_.PD_AUTO_HIDE
PD_APP_MODAL = _core_.PD_APP_MODAL PD_APP_MODAL = _core_.PD_APP_MODAL
PD_CAN_ABORT = _core_.PD_CAN_ABORT PD_CAN_ABORT = _core_.PD_CAN_ABORT
@@ -3070,12 +3066,11 @@ def _ImageFromBuffer(*args, **kwargs):
def ImageFromBuffer(width, height, dataBuffer, alphaBuffer=None): def ImageFromBuffer(width, height, dataBuffer, alphaBuffer=None):
""" """
Creates a `wx.Image` from the data in dataBuffer. The dataBuffer Creates a `wx.Image` from the data in dataBuffer. The dataBuffer
parameter must be a Python object that implements the buffer interface, or parameter must be a Python object that implements the buffer interface,
is convertable to a buffer object, such as a string, array, etc. The such as a string, array, etc. The dataBuffer object is expected to
dataBuffer object is expected to contain a series of RGB bytes and be contain a series of RGB bytes and be width*height*3 bytes long. A buffer
width*height*3 bytes long. A buffer object can optionally be supplied for object can optionally be supplied for the image's alpha channel data, and
the image's alpha channel data, and it is expected to be width*height it is expected to be width*height bytes long.
bytes long.
The wx.Image will be created with its data and alpha pointers initialized The wx.Image will be created with its data and alpha pointers initialized
to the memory address pointed to by the buffer objects, thus saving the to the memory address pointed to by the buffer objects, thus saving the
@@ -3093,10 +3088,6 @@ def ImageFromBuffer(width, height, dataBuffer, alphaBuffer=None):
the objects used for the data and alpha buffers in a way that would cause the objects used for the data and alpha buffers in a way that would cause
them to change size. them to change size.
""" """
if not isinstance(dataBuffer, buffer):
dataBuffer = buffer(dataBuffer)
if alphaBuffer is not None and not isinstance(alphaBuffer, buffer):
alphaBuffer = buffer(alphaBuffer)
image = _core_._ImageFromBuffer(width, height, dataBuffer, alphaBuffer) image = _core_._ImageFromBuffer(width, height, dataBuffer, alphaBuffer)
image._buffer = dataBuffer image._buffer = dataBuffer
image._alpha = alphaBuffer image._alpha = alphaBuffer
@@ -7461,6 +7452,11 @@ _core_.EventLoopActivator_swigregister(EventLoopActivator)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
ACCEL_ALT = _core_.ACCEL_ALT
ACCEL_CTRL = _core_.ACCEL_CTRL
ACCEL_SHIFT = _core_.ACCEL_SHIFT
ACCEL_NORMAL = _core_.ACCEL_NORMAL
ACCEL_CMD = _core_.ACCEL_CMD
class AcceleratorEntry(object): class AcceleratorEntry(object):
""" """
A class used to define items in an `wx.AcceleratorTable`. wxPython A class used to define items in an `wx.AcceleratorTable`. wxPython

View File

@@ -13429,9 +13429,7 @@ SWIGINTERN PyObject *_wrap_new_ImageFromData(PyObject *SWIGUNUSEDPARM(self), PyO
} }
arg2 = static_cast< int >(val2); arg2 = static_cast< int >(val2);
{ {
if (obj2 != Py_None) { if (PyObject_AsReadBuffer(obj2, (const void**)(&arg3), &arg4) == -1) SWIG_fail;
if (!PyArg_Parse(obj2, "t#", &arg3, &arg4)) SWIG_fail;
}
} }
{ {
PyThreadState* __tstate = wxPyBeginAllowThreads(); PyThreadState* __tstate = wxPyBeginAllowThreads();
@@ -13479,13 +13477,11 @@ SWIGINTERN PyObject *_wrap_new_ImageFromDataWithAlpha(PyObject *SWIGUNUSEDPARM(s
} }
arg2 = static_cast< int >(val2); arg2 = static_cast< int >(val2);
{ {
if (obj2 != Py_None) { if (PyObject_AsReadBuffer(obj2, (const void**)(&arg3), &arg4) == -1) SWIG_fail;
if (!PyArg_Parse(obj2, "t#", &arg3, &arg4)) SWIG_fail;
}
} }
{ {
if (obj3 != Py_None) { if (obj3 != Py_None) {
if (!PyArg_Parse(obj3, "t#", &arg5, &arg6)) SWIG_fail; if (PyObject_AsReadBuffer(obj3, (const void**)(&arg5), &arg6) == -1) SWIG_fail;
} }
} }
{ {
@@ -15508,9 +15504,7 @@ SWIGINTERN PyObject *_wrap_Image_SetData(PyObject *SWIGUNUSEDPARM(self), PyObjec
} }
arg1 = reinterpret_cast< wxImage * >(argp1); arg1 = reinterpret_cast< wxImage * >(argp1);
{ {
if (obj1 != Py_None) { if (PyObject_AsReadBuffer(obj1, (const void**)(&arg2), &arg3) == -1) SWIG_fail;
if (!PyArg_Parse(obj1, "t#", &arg2, &arg3)) SWIG_fail;
}
} }
{ {
PyThreadState* __tstate = wxPyBeginAllowThreads(); PyThreadState* __tstate = wxPyBeginAllowThreads();
@@ -15573,9 +15567,7 @@ SWIGINTERN PyObject *_wrap_Image_SetDataBuffer(PyObject *SWIGUNUSEDPARM(self), P
} }
arg1 = reinterpret_cast< wxImage * >(argp1); arg1 = reinterpret_cast< wxImage * >(argp1);
{ {
if (obj1 != Py_None) { if (PyObject_AsReadBuffer(obj1, (const void**)(&arg2), &arg3) == -1) SWIG_fail;
if (!PyArg_Parse(obj1, "t#", &arg2, &arg3)) SWIG_fail;
}
} }
{ {
PyThreadState* __tstate = wxPyBeginAllowThreads(); PyThreadState* __tstate = wxPyBeginAllowThreads();
@@ -15639,7 +15631,7 @@ SWIGINTERN PyObject *_wrap_Image_SetAlphaData(PyObject *SWIGUNUSEDPARM(self), Py
arg1 = reinterpret_cast< wxImage * >(argp1); arg1 = reinterpret_cast< wxImage * >(argp1);
{ {
if (obj1 != Py_None) { if (obj1 != Py_None) {
if (!PyArg_Parse(obj1, "t#", &arg2, &arg3)) SWIG_fail; if (PyObject_AsReadBuffer(obj1, (const void**)(&arg2), &arg3) == -1) SWIG_fail;
} }
} }
{ {
@@ -15704,7 +15696,7 @@ SWIGINTERN PyObject *_wrap_Image_SetAlphaBuffer(PyObject *SWIGUNUSEDPARM(self),
arg1 = reinterpret_cast< wxImage * >(argp1); arg1 = reinterpret_cast< wxImage * >(argp1);
{ {
if (obj1 != Py_None) { if (obj1 != Py_None) {
if (!PyArg_Parse(obj1, "t#", &arg2, &arg3)) SWIG_fail; if (PyObject_AsReadBuffer(obj1, (const void**)(&arg2), &arg3) == -1) SWIG_fail;
} }
} }
{ {
@@ -17081,14 +17073,12 @@ SWIGINTERN PyObject *_wrap__ImageFromBuffer(PyObject *SWIGUNUSEDPARM(self), PyOb
} }
arg2 = static_cast< int >(val2); arg2 = static_cast< int >(val2);
{ {
if (obj2 != Py_None) { if (PyObject_AsReadBuffer(obj2, (const void**)(&arg3), &arg4) == -1) SWIG_fail;
if (!PyArg_Parse(obj2, "t#", &arg3, &arg4)) SWIG_fail;
}
} }
if (obj3) { if (obj3) {
{ {
if (obj3 != Py_None) { if (obj3 != Py_None) {
if (!PyArg_Parse(obj3, "t#", &arg5, &arg6)) SWIG_fail; if (PyObject_AsReadBuffer(obj3, (const void**)(&arg5), &arg6) == -1) SWIG_fail;
} }
} }
} }
@@ -56283,10 +56273,6 @@ SWIGEXPORT void SWIG_init(void) {
SWIG_Python_SetConstant(d, "ID_UNDELETE",SWIG_From_int(static_cast< int >(wxID_UNDELETE))); SWIG_Python_SetConstant(d, "ID_UNDELETE",SWIG_From_int(static_cast< int >(wxID_UNDELETE)));
SWIG_Python_SetConstant(d, "ID_REVERT_TO_SAVED",SWIG_From_int(static_cast< int >(wxID_REVERT_TO_SAVED))); SWIG_Python_SetConstant(d, "ID_REVERT_TO_SAVED",SWIG_From_int(static_cast< int >(wxID_REVERT_TO_SAVED)));
SWIG_Python_SetConstant(d, "ID_HIGHEST",SWIG_From_int(static_cast< int >(wxID_HIGHEST))); SWIG_Python_SetConstant(d, "ID_HIGHEST",SWIG_From_int(static_cast< int >(wxID_HIGHEST)));
SWIG_Python_SetConstant(d, "ACCEL_ALT",SWIG_From_int(static_cast< int >(wxACCEL_ALT)));
SWIG_Python_SetConstant(d, "ACCEL_CTRL",SWIG_From_int(static_cast< int >(wxACCEL_CTRL)));
SWIG_Python_SetConstant(d, "ACCEL_SHIFT",SWIG_From_int(static_cast< int >(wxACCEL_SHIFT)));
SWIG_Python_SetConstant(d, "ACCEL_NORMAL",SWIG_From_int(static_cast< int >(wxACCEL_NORMAL)));
SWIG_Python_SetConstant(d, "PD_AUTO_HIDE",SWIG_From_int(static_cast< int >(wxPD_AUTO_HIDE))); SWIG_Python_SetConstant(d, "PD_AUTO_HIDE",SWIG_From_int(static_cast< int >(wxPD_AUTO_HIDE)));
SWIG_Python_SetConstant(d, "PD_APP_MODAL",SWIG_From_int(static_cast< int >(wxPD_APP_MODAL))); SWIG_Python_SetConstant(d, "PD_APP_MODAL",SWIG_From_int(static_cast< int >(wxPD_APP_MODAL)));
SWIG_Python_SetConstant(d, "PD_CAN_ABORT",SWIG_From_int(static_cast< int >(wxPD_CAN_ABORT))); SWIG_Python_SetConstant(d, "PD_CAN_ABORT",SWIG_From_int(static_cast< int >(wxPD_CAN_ABORT)));
@@ -56935,6 +56921,11 @@ SWIGEXPORT void SWIG_init(void) {
SWIG_Python_SetConstant(d, "PYAPP_ASSERT_LOG",SWIG_From_int(static_cast< int >(wxPYAPP_ASSERT_LOG))); SWIG_Python_SetConstant(d, "PYAPP_ASSERT_LOG",SWIG_From_int(static_cast< int >(wxPYAPP_ASSERT_LOG)));
SWIG_Python_SetConstant(d, "PRINT_WINDOWS",SWIG_From_int(static_cast< int >(wxPRINT_WINDOWS))); SWIG_Python_SetConstant(d, "PRINT_WINDOWS",SWIG_From_int(static_cast< int >(wxPRINT_WINDOWS)));
SWIG_Python_SetConstant(d, "PRINT_POSTSCRIPT",SWIG_From_int(static_cast< int >(wxPRINT_POSTSCRIPT))); SWIG_Python_SetConstant(d, "PRINT_POSTSCRIPT",SWIG_From_int(static_cast< int >(wxPRINT_POSTSCRIPT)));
SWIG_Python_SetConstant(d, "ACCEL_ALT",SWIG_From_int(static_cast< int >(wxACCEL_ALT)));
SWIG_Python_SetConstant(d, "ACCEL_CTRL",SWIG_From_int(static_cast< int >(wxACCEL_CTRL)));
SWIG_Python_SetConstant(d, "ACCEL_SHIFT",SWIG_From_int(static_cast< int >(wxACCEL_SHIFT)));
SWIG_Python_SetConstant(d, "ACCEL_NORMAL",SWIG_From_int(static_cast< int >(wxACCEL_NORMAL)));
SWIG_Python_SetConstant(d, "ACCEL_CMD",SWIG_From_int(static_cast< int >(wxACCEL_CMD)));
SWIG_addvarlink(SWIG_globals(),(char*)"NullAcceleratorTable",NullAcceleratorTable_get, NullAcceleratorTable_set); SWIG_addvarlink(SWIG_globals(),(char*)"NullAcceleratorTable",NullAcceleratorTable_get, NullAcceleratorTable_set);
SWIG_addvarlink(SWIG_globals(),(char*)"PanelNameStr",PanelNameStr_get, PanelNameStr_set); SWIG_addvarlink(SWIG_globals(),(char*)"PanelNameStr",PanelNameStr_get, PanelNameStr_set);
SWIG_Python_SetConstant(d, "WINDOW_VARIANT_NORMAL",SWIG_From_int(static_cast< int >(wxWINDOW_VARIANT_NORMAL))); SWIG_Python_SetConstant(d, "WINDOW_VARIANT_NORMAL",SWIG_From_int(static_cast< int >(wxWINDOW_VARIANT_NORMAL)));

View File

@@ -728,29 +728,26 @@ def _BitmapFromBuffer(*args, **kwargs):
def BitmapFromBuffer(width, height, dataBuffer, alphaBuffer=None): def BitmapFromBuffer(width, height, dataBuffer, alphaBuffer=None):
""" """
Creates a `wx.Bitmap` from the data in dataBuffer. The dataBuffer Creates a `wx.Bitmap` from the data in dataBuffer. The dataBuffer
parameter must be a Python object that implements the buffer interface, or parameter must be a Python object that implements the buffer
is convertable to a buffer object, such as a string, array, etc. The interface, such as a string, array, etc. The dataBuffer object is
dataBuffer object is expected to contain a series of RGB bytes and be expected to contain a series of RGB bytes and be width*height*3
width*height*3 bytes long. A buffer object can optionally be supplied for bytes long. A buffer object can optionally be supplied for the
the image's alpha channel data, and it is expected to be width*height image's alpha channel data, and it is expected to be width*height
bytes long. On Windows the RGB values are 'premultiplied' by the alpha bytes long. On Windows the RGB values are 'premultiplied' by the
values. (The other platforms appear to already be premultiplying the alpha values. (The other platforms do the multiplication
alpha.) themselves.)
Unlike `wx.ImageFromBuffer` the bitmap created with this function does not Unlike `wx.ImageFromBuffer` the bitmap created with this function
share the memory buffer with the buffer object. This is because the does not share the memory buffer with the buffer object. This is
native pixel buffer format varies on different platforms, and so instead because the native pixel buffer format varies on different
an efficient as possible copy of the data is made from the buffer objects platforms, and so instead an efficient as possible copy of the
to the bitmap's native pixel buffer. For direct access to a bitmap's data is made from the buffer objects to the bitmap's native pixel
pixel buffer see `wx.NativePixelData` and `wx.AlphaPixelData`. buffer. For direct access to a bitmap's pixel buffer see
`wx.NativePixelData` and `wx.AlphaPixelData`.
:see: `wx.Bitmap`, `wx.BitmapFromBufferRGBA`, `wx.NativePixelData`, :see: `wx.Bitmap`, `wx.BitmapFromBufferRGBA`, `wx.NativePixelData`,
`wx.AlphaPixelData`, `wx.ImageFromBuffer` `wx.AlphaPixelData`, `wx.ImageFromBuffer`
""" """
if not isinstance(dataBuffer, buffer):
dataBuffer = buffer(dataBuffer)
if alphaBuffer is not None and not isinstance(alphaBuffer, buffer):
alphaBuffer = buffer(alphaBuffer)
if alphaBuffer is not None: if alphaBuffer is not None:
return _gdi_._BitmapFromBufferAlpha(width, height, dataBuffer, alphaBuffer) return _gdi_._BitmapFromBufferAlpha(width, height, dataBuffer, alphaBuffer)
else: else:
@@ -763,25 +760,24 @@ def _BitmapFromBufferRGBA(*args, **kwargs):
def BitmapFromBufferRGBA(width, height, dataBuffer): def BitmapFromBufferRGBA(width, height, dataBuffer):
""" """
Creates a `wx.Bitmap` from the data in dataBuffer. The dataBuffer Creates a `wx.Bitmap` from the data in dataBuffer. The dataBuffer
parameter must be a Python object that implements the buffer interface, or parameter must be a Python object that implements the buffer
is convertable to a buffer object, such as a string, array, etc. The interface, such as a string, array, etc. The dataBuffer object is
dataBuffer object is expected to contain a series of RGBA bytes (red, expected to contain a series of RGBA bytes (red, green, blue and
green, blue and alpha) and be width*height*4 bytes long. On Windows the alpha) and be width*height*4 bytes long. On Windows the RGB
RGB values are 'premultiplied' by the alpha values. (The other platforms values are 'premultiplied' by the alpha values. (The other
appear to already be premultiplying the alpha.) platforms do the multiplication themselves.)
Unlike `wx.ImageFromBuffer` the bitmap created with this function does not Unlike `wx.ImageFromBuffer` the bitmap created with this function
share the memory buffer with the buffer object. This is because the does not share the memory buffer with the buffer object. This is
native pixel buffer format varies on different platforms, and so instead because the native pixel buffer format varies on different
an efficient as possible copy of the data is made from the buffer object platforms, and so instead an efficient as possible copy of the
to the bitmap's native pixel buffer. For direct access to a bitmap's data is made from the buffer object to the bitmap's native pixel
pixel buffer see `wx.NativePixelData` and `wx.AlphaPixelData`. buffer. For direct access to a bitmap's pixel buffer see
`wx.NativePixelData` and `wx.AlphaPixelData`.
:see: `wx.Bitmap`, `wx.BitmapFromBuffer`, `wx.NativePixelData`, :see: `wx.Bitmap`, `wx.BitmapFromBuffer`, `wx.NativePixelData`,
`wx.AlphaPixelData`, `wx.ImageFromBuffer` `wx.AlphaPixelData`, `wx.ImageFromBuffer`
""" """
if not isinstance(dataBuffer, buffer):
dataBuffer = buffer(dataBuffer)
return _gdi_._BitmapFromBufferRGBA(width, height, dataBuffer) return _gdi_._BitmapFromBufferRGBA(width, height, dataBuffer)
class PixelDataBase(object): class PixelDataBase(object):

View File

@@ -6722,13 +6722,11 @@ SWIGINTERN PyObject *_wrap__BitmapFromBufferAlpha(PyObject *SWIGUNUSEDPARM(self)
} }
arg2 = static_cast< int >(val2); arg2 = static_cast< int >(val2);
{ {
if (obj2 != Py_None) { if (PyObject_AsReadBuffer(obj2, (const void**)(&arg3), &arg4) == -1) SWIG_fail;
if (!PyArg_Parse(obj2, "t#", &arg3, &arg4)) SWIG_fail;
}
} }
{ {
if (obj3 != Py_None) { if (obj3 != Py_None) {
if (!PyArg_Parse(obj3, "t#", &arg5, &arg6)) SWIG_fail; if (PyObject_AsReadBuffer(obj3, (const void**)(&arg5), &arg6) == -1) SWIG_fail;
} }
} }
{ {
@@ -6772,9 +6770,7 @@ SWIGINTERN PyObject *_wrap__BitmapFromBuffer(PyObject *SWIGUNUSEDPARM(self), PyO
} }
arg2 = static_cast< int >(val2); arg2 = static_cast< int >(val2);
{ {
if (obj2 != Py_None) { if (PyObject_AsReadBuffer(obj2, (const void**)(&arg3), &arg4) == -1) SWIG_fail;
if (!PyArg_Parse(obj2, "t#", &arg3, &arg4)) SWIG_fail;
}
} }
{ {
result = (wxBitmap *)_BitmapFromBuffer(arg1,arg2,arg3,arg4); result = (wxBitmap *)_BitmapFromBuffer(arg1,arg2,arg3,arg4);
@@ -6817,9 +6813,7 @@ SWIGINTERN PyObject *_wrap__BitmapFromBufferRGBA(PyObject *SWIGUNUSEDPARM(self),
} }
arg2 = static_cast< int >(val2); arg2 = static_cast< int >(val2);
{ {
if (obj2 != Py_None) { if (PyObject_AsReadBuffer(obj2, (const void**)(&arg3), &arg4) == -1) SWIG_fail;
if (!PyArg_Parse(obj2, "t#", &arg3, &arg4)) SWIG_fail;
}
} }
{ {
result = (wxBitmap *)_BitmapFromBufferRGBA(arg1,arg2,arg3,arg4); result = (wxBitmap *)_BitmapFromBufferRGBA(arg1,arg2,arg3,arg4);

View File

@@ -275,10 +275,6 @@ ID_ZOOM_OUT = _core_.ID_ZOOM_OUT
ID_UNDELETE = _core_.ID_UNDELETE ID_UNDELETE = _core_.ID_UNDELETE
ID_REVERT_TO_SAVED = _core_.ID_REVERT_TO_SAVED ID_REVERT_TO_SAVED = _core_.ID_REVERT_TO_SAVED
ID_HIGHEST = _core_.ID_HIGHEST ID_HIGHEST = _core_.ID_HIGHEST
ACCEL_ALT = _core_.ACCEL_ALT
ACCEL_CTRL = _core_.ACCEL_CTRL
ACCEL_SHIFT = _core_.ACCEL_SHIFT
ACCEL_NORMAL = _core_.ACCEL_NORMAL
PD_AUTO_HIDE = _core_.PD_AUTO_HIDE PD_AUTO_HIDE = _core_.PD_AUTO_HIDE
PD_APP_MODAL = _core_.PD_APP_MODAL PD_APP_MODAL = _core_.PD_APP_MODAL
PD_CAN_ABORT = _core_.PD_CAN_ABORT PD_CAN_ABORT = _core_.PD_CAN_ABORT
@@ -3070,12 +3066,11 @@ def _ImageFromBuffer(*args, **kwargs):
def ImageFromBuffer(width, height, dataBuffer, alphaBuffer=None): def ImageFromBuffer(width, height, dataBuffer, alphaBuffer=None):
""" """
Creates a `wx.Image` from the data in dataBuffer. The dataBuffer Creates a `wx.Image` from the data in dataBuffer. The dataBuffer
parameter must be a Python object that implements the buffer interface, or parameter must be a Python object that implements the buffer interface,
is convertable to a buffer object, such as a string, array, etc. The such as a string, array, etc. The dataBuffer object is expected to
dataBuffer object is expected to contain a series of RGB bytes and be contain a series of RGB bytes and be width*height*3 bytes long. A buffer
width*height*3 bytes long. A buffer object can optionally be supplied for object can optionally be supplied for the image's alpha channel data, and
the image's alpha channel data, and it is expected to be width*height it is expected to be width*height bytes long.
bytes long.
The wx.Image will be created with its data and alpha pointers initialized The wx.Image will be created with its data and alpha pointers initialized
to the memory address pointed to by the buffer objects, thus saving the to the memory address pointed to by the buffer objects, thus saving the
@@ -3093,10 +3088,6 @@ def ImageFromBuffer(width, height, dataBuffer, alphaBuffer=None):
the objects used for the data and alpha buffers in a way that would cause the objects used for the data and alpha buffers in a way that would cause
them to change size. them to change size.
""" """
if not isinstance(dataBuffer, buffer):
dataBuffer = buffer(dataBuffer)
if alphaBuffer is not None and not isinstance(alphaBuffer, buffer):
alphaBuffer = buffer(alphaBuffer)
image = _core_._ImageFromBuffer(width, height, dataBuffer, alphaBuffer) image = _core_._ImageFromBuffer(width, height, dataBuffer, alphaBuffer)
image._buffer = dataBuffer image._buffer = dataBuffer
image._alpha = alphaBuffer image._alpha = alphaBuffer
@@ -7461,6 +7452,11 @@ _core_.EventLoopActivator_swigregister(EventLoopActivator)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
ACCEL_ALT = _core_.ACCEL_ALT
ACCEL_CTRL = _core_.ACCEL_CTRL
ACCEL_SHIFT = _core_.ACCEL_SHIFT
ACCEL_NORMAL = _core_.ACCEL_NORMAL
ACCEL_CMD = _core_.ACCEL_CMD
class AcceleratorEntry(object): class AcceleratorEntry(object):
""" """
A class used to define items in an `wx.AcceleratorTable`. wxPython A class used to define items in an `wx.AcceleratorTable`. wxPython

View File

@@ -13414,9 +13414,7 @@ SWIGINTERN PyObject *_wrap_new_ImageFromData(PyObject *SWIGUNUSEDPARM(self), PyO
} }
arg2 = static_cast< int >(val2); arg2 = static_cast< int >(val2);
{ {
if (obj2 != Py_None) { if (PyObject_AsReadBuffer(obj2, (const void**)(&arg3), &arg4) == -1) SWIG_fail;
if (!PyArg_Parse(obj2, "t#", &arg3, &arg4)) SWIG_fail;
}
} }
{ {
PyThreadState* __tstate = wxPyBeginAllowThreads(); PyThreadState* __tstate = wxPyBeginAllowThreads();
@@ -13464,13 +13462,11 @@ SWIGINTERN PyObject *_wrap_new_ImageFromDataWithAlpha(PyObject *SWIGUNUSEDPARM(s
} }
arg2 = static_cast< int >(val2); arg2 = static_cast< int >(val2);
{ {
if (obj2 != Py_None) { if (PyObject_AsReadBuffer(obj2, (const void**)(&arg3), &arg4) == -1) SWIG_fail;
if (!PyArg_Parse(obj2, "t#", &arg3, &arg4)) SWIG_fail;
}
} }
{ {
if (obj3 != Py_None) { if (obj3 != Py_None) {
if (!PyArg_Parse(obj3, "t#", &arg5, &arg6)) SWIG_fail; if (PyObject_AsReadBuffer(obj3, (const void**)(&arg5), &arg6) == -1) SWIG_fail;
} }
} }
{ {
@@ -15493,9 +15489,7 @@ SWIGINTERN PyObject *_wrap_Image_SetData(PyObject *SWIGUNUSEDPARM(self), PyObjec
} }
arg1 = reinterpret_cast< wxImage * >(argp1); arg1 = reinterpret_cast< wxImage * >(argp1);
{ {
if (obj1 != Py_None) { if (PyObject_AsReadBuffer(obj1, (const void**)(&arg2), &arg3) == -1) SWIG_fail;
if (!PyArg_Parse(obj1, "t#", &arg2, &arg3)) SWIG_fail;
}
} }
{ {
PyThreadState* __tstate = wxPyBeginAllowThreads(); PyThreadState* __tstate = wxPyBeginAllowThreads();
@@ -15558,9 +15552,7 @@ SWIGINTERN PyObject *_wrap_Image_SetDataBuffer(PyObject *SWIGUNUSEDPARM(self), P
} }
arg1 = reinterpret_cast< wxImage * >(argp1); arg1 = reinterpret_cast< wxImage * >(argp1);
{ {
if (obj1 != Py_None) { if (PyObject_AsReadBuffer(obj1, (const void**)(&arg2), &arg3) == -1) SWIG_fail;
if (!PyArg_Parse(obj1, "t#", &arg2, &arg3)) SWIG_fail;
}
} }
{ {
PyThreadState* __tstate = wxPyBeginAllowThreads(); PyThreadState* __tstate = wxPyBeginAllowThreads();
@@ -15624,7 +15616,7 @@ SWIGINTERN PyObject *_wrap_Image_SetAlphaData(PyObject *SWIGUNUSEDPARM(self), Py
arg1 = reinterpret_cast< wxImage * >(argp1); arg1 = reinterpret_cast< wxImage * >(argp1);
{ {
if (obj1 != Py_None) { if (obj1 != Py_None) {
if (!PyArg_Parse(obj1, "t#", &arg2, &arg3)) SWIG_fail; if (PyObject_AsReadBuffer(obj1, (const void**)(&arg2), &arg3) == -1) SWIG_fail;
} }
} }
{ {
@@ -15689,7 +15681,7 @@ SWIGINTERN PyObject *_wrap_Image_SetAlphaBuffer(PyObject *SWIGUNUSEDPARM(self),
arg1 = reinterpret_cast< wxImage * >(argp1); arg1 = reinterpret_cast< wxImage * >(argp1);
{ {
if (obj1 != Py_None) { if (obj1 != Py_None) {
if (!PyArg_Parse(obj1, "t#", &arg2, &arg3)) SWIG_fail; if (PyObject_AsReadBuffer(obj1, (const void**)(&arg2), &arg3) == -1) SWIG_fail;
} }
} }
{ {
@@ -17066,14 +17058,12 @@ SWIGINTERN PyObject *_wrap__ImageFromBuffer(PyObject *SWIGUNUSEDPARM(self), PyOb
} }
arg2 = static_cast< int >(val2); arg2 = static_cast< int >(val2);
{ {
if (obj2 != Py_None) { if (PyObject_AsReadBuffer(obj2, (const void**)(&arg3), &arg4) == -1) SWIG_fail;
if (!PyArg_Parse(obj2, "t#", &arg3, &arg4)) SWIG_fail;
}
} }
if (obj3) { if (obj3) {
{ {
if (obj3 != Py_None) { if (obj3 != Py_None) {
if (!PyArg_Parse(obj3, "t#", &arg5, &arg6)) SWIG_fail; if (PyObject_AsReadBuffer(obj3, (const void**)(&arg5), &arg6) == -1) SWIG_fail;
} }
} }
} }
@@ -56310,10 +56300,6 @@ SWIGEXPORT void SWIG_init(void) {
SWIG_Python_SetConstant(d, "ID_UNDELETE",SWIG_From_int(static_cast< int >(wxID_UNDELETE))); SWIG_Python_SetConstant(d, "ID_UNDELETE",SWIG_From_int(static_cast< int >(wxID_UNDELETE)));
SWIG_Python_SetConstant(d, "ID_REVERT_TO_SAVED",SWIG_From_int(static_cast< int >(wxID_REVERT_TO_SAVED))); SWIG_Python_SetConstant(d, "ID_REVERT_TO_SAVED",SWIG_From_int(static_cast< int >(wxID_REVERT_TO_SAVED)));
SWIG_Python_SetConstant(d, "ID_HIGHEST",SWIG_From_int(static_cast< int >(wxID_HIGHEST))); SWIG_Python_SetConstant(d, "ID_HIGHEST",SWIG_From_int(static_cast< int >(wxID_HIGHEST)));
SWIG_Python_SetConstant(d, "ACCEL_ALT",SWIG_From_int(static_cast< int >(wxACCEL_ALT)));
SWIG_Python_SetConstant(d, "ACCEL_CTRL",SWIG_From_int(static_cast< int >(wxACCEL_CTRL)));
SWIG_Python_SetConstant(d, "ACCEL_SHIFT",SWIG_From_int(static_cast< int >(wxACCEL_SHIFT)));
SWIG_Python_SetConstant(d, "ACCEL_NORMAL",SWIG_From_int(static_cast< int >(wxACCEL_NORMAL)));
SWIG_Python_SetConstant(d, "PD_AUTO_HIDE",SWIG_From_int(static_cast< int >(wxPD_AUTO_HIDE))); SWIG_Python_SetConstant(d, "PD_AUTO_HIDE",SWIG_From_int(static_cast< int >(wxPD_AUTO_HIDE)));
SWIG_Python_SetConstant(d, "PD_APP_MODAL",SWIG_From_int(static_cast< int >(wxPD_APP_MODAL))); SWIG_Python_SetConstant(d, "PD_APP_MODAL",SWIG_From_int(static_cast< int >(wxPD_APP_MODAL)));
SWIG_Python_SetConstant(d, "PD_CAN_ABORT",SWIG_From_int(static_cast< int >(wxPD_CAN_ABORT))); SWIG_Python_SetConstant(d, "PD_CAN_ABORT",SWIG_From_int(static_cast< int >(wxPD_CAN_ABORT)));
@@ -56962,6 +56948,11 @@ SWIGEXPORT void SWIG_init(void) {
SWIG_Python_SetConstant(d, "PYAPP_ASSERT_LOG",SWIG_From_int(static_cast< int >(wxPYAPP_ASSERT_LOG))); SWIG_Python_SetConstant(d, "PYAPP_ASSERT_LOG",SWIG_From_int(static_cast< int >(wxPYAPP_ASSERT_LOG)));
SWIG_Python_SetConstant(d, "PRINT_WINDOWS",SWIG_From_int(static_cast< int >(wxPRINT_WINDOWS))); SWIG_Python_SetConstant(d, "PRINT_WINDOWS",SWIG_From_int(static_cast< int >(wxPRINT_WINDOWS)));
SWIG_Python_SetConstant(d, "PRINT_POSTSCRIPT",SWIG_From_int(static_cast< int >(wxPRINT_POSTSCRIPT))); SWIG_Python_SetConstant(d, "PRINT_POSTSCRIPT",SWIG_From_int(static_cast< int >(wxPRINT_POSTSCRIPT)));
SWIG_Python_SetConstant(d, "ACCEL_ALT",SWIG_From_int(static_cast< int >(wxACCEL_ALT)));
SWIG_Python_SetConstant(d, "ACCEL_CTRL",SWIG_From_int(static_cast< int >(wxACCEL_CTRL)));
SWIG_Python_SetConstant(d, "ACCEL_SHIFT",SWIG_From_int(static_cast< int >(wxACCEL_SHIFT)));
SWIG_Python_SetConstant(d, "ACCEL_NORMAL",SWIG_From_int(static_cast< int >(wxACCEL_NORMAL)));
SWIG_Python_SetConstant(d, "ACCEL_CMD",SWIG_From_int(static_cast< int >(wxACCEL_CMD)));
SWIG_addvarlink(SWIG_globals(),(char*)"NullAcceleratorTable",NullAcceleratorTable_get, NullAcceleratorTable_set); SWIG_addvarlink(SWIG_globals(),(char*)"NullAcceleratorTable",NullAcceleratorTable_get, NullAcceleratorTable_set);
SWIG_addvarlink(SWIG_globals(),(char*)"PanelNameStr",PanelNameStr_get, PanelNameStr_set); SWIG_addvarlink(SWIG_globals(),(char*)"PanelNameStr",PanelNameStr_get, PanelNameStr_set);
SWIG_Python_SetConstant(d, "WINDOW_VARIANT_NORMAL",SWIG_From_int(static_cast< int >(wxWINDOW_VARIANT_NORMAL))); SWIG_Python_SetConstant(d, "WINDOW_VARIANT_NORMAL",SWIG_From_int(static_cast< int >(wxWINDOW_VARIANT_NORMAL)));

View File

@@ -748,29 +748,26 @@ def _BitmapFromBuffer(*args, **kwargs):
def BitmapFromBuffer(width, height, dataBuffer, alphaBuffer=None): def BitmapFromBuffer(width, height, dataBuffer, alphaBuffer=None):
""" """
Creates a `wx.Bitmap` from the data in dataBuffer. The dataBuffer Creates a `wx.Bitmap` from the data in dataBuffer. The dataBuffer
parameter must be a Python object that implements the buffer interface, or parameter must be a Python object that implements the buffer
is convertable to a buffer object, such as a string, array, etc. The interface, such as a string, array, etc. The dataBuffer object is
dataBuffer object is expected to contain a series of RGB bytes and be expected to contain a series of RGB bytes and be width*height*3
width*height*3 bytes long. A buffer object can optionally be supplied for bytes long. A buffer object can optionally be supplied for the
the image's alpha channel data, and it is expected to be width*height image's alpha channel data, and it is expected to be width*height
bytes long. On Windows the RGB values are 'premultiplied' by the alpha bytes long. On Windows the RGB values are 'premultiplied' by the
values. (The other platforms appear to already be premultiplying the alpha values. (The other platforms do the multiplication
alpha.) themselves.)
Unlike `wx.ImageFromBuffer` the bitmap created with this function does not Unlike `wx.ImageFromBuffer` the bitmap created with this function
share the memory buffer with the buffer object. This is because the does not share the memory buffer with the buffer object. This is
native pixel buffer format varies on different platforms, and so instead because the native pixel buffer format varies on different
an efficient as possible copy of the data is made from the buffer objects platforms, and so instead an efficient as possible copy of the
to the bitmap's native pixel buffer. For direct access to a bitmap's data is made from the buffer objects to the bitmap's native pixel
pixel buffer see `wx.NativePixelData` and `wx.AlphaPixelData`. buffer. For direct access to a bitmap's pixel buffer see
`wx.NativePixelData` and `wx.AlphaPixelData`.
:see: `wx.Bitmap`, `wx.BitmapFromBufferRGBA`, `wx.NativePixelData`, :see: `wx.Bitmap`, `wx.BitmapFromBufferRGBA`, `wx.NativePixelData`,
`wx.AlphaPixelData`, `wx.ImageFromBuffer` `wx.AlphaPixelData`, `wx.ImageFromBuffer`
""" """
if not isinstance(dataBuffer, buffer):
dataBuffer = buffer(dataBuffer)
if alphaBuffer is not None and not isinstance(alphaBuffer, buffer):
alphaBuffer = buffer(alphaBuffer)
if alphaBuffer is not None: if alphaBuffer is not None:
return _gdi_._BitmapFromBufferAlpha(width, height, dataBuffer, alphaBuffer) return _gdi_._BitmapFromBufferAlpha(width, height, dataBuffer, alphaBuffer)
else: else:
@@ -783,25 +780,24 @@ def _BitmapFromBufferRGBA(*args, **kwargs):
def BitmapFromBufferRGBA(width, height, dataBuffer): def BitmapFromBufferRGBA(width, height, dataBuffer):
""" """
Creates a `wx.Bitmap` from the data in dataBuffer. The dataBuffer Creates a `wx.Bitmap` from the data in dataBuffer. The dataBuffer
parameter must be a Python object that implements the buffer interface, or parameter must be a Python object that implements the buffer
is convertable to a buffer object, such as a string, array, etc. The interface, such as a string, array, etc. The dataBuffer object is
dataBuffer object is expected to contain a series of RGBA bytes (red, expected to contain a series of RGBA bytes (red, green, blue and
green, blue and alpha) and be width*height*4 bytes long. On Windows the alpha) and be width*height*4 bytes long. On Windows the RGB
RGB values are 'premultiplied' by the alpha values. (The other platforms values are 'premultiplied' by the alpha values. (The other
appear to already be premultiplying the alpha.) platforms do the multiplication themselves.)
Unlike `wx.ImageFromBuffer` the bitmap created with this function does not Unlike `wx.ImageFromBuffer` the bitmap created with this function
share the memory buffer with the buffer object. This is because the does not share the memory buffer with the buffer object. This is
native pixel buffer format varies on different platforms, and so instead because the native pixel buffer format varies on different
an efficient as possible copy of the data is made from the buffer object platforms, and so instead an efficient as possible copy of the
to the bitmap's native pixel buffer. For direct access to a bitmap's data is made from the buffer object to the bitmap's native pixel
pixel buffer see `wx.NativePixelData` and `wx.AlphaPixelData`. buffer. For direct access to a bitmap's pixel buffer see
`wx.NativePixelData` and `wx.AlphaPixelData`.
:see: `wx.Bitmap`, `wx.BitmapFromBuffer`, `wx.NativePixelData`, :see: `wx.Bitmap`, `wx.BitmapFromBuffer`, `wx.NativePixelData`,
`wx.AlphaPixelData`, `wx.ImageFromBuffer` `wx.AlphaPixelData`, `wx.ImageFromBuffer`
""" """
if not isinstance(dataBuffer, buffer):
dataBuffer = buffer(dataBuffer)
return _gdi_._BitmapFromBufferRGBA(width, height, dataBuffer) return _gdi_._BitmapFromBufferRGBA(width, height, dataBuffer)
class PixelDataBase(object): class PixelDataBase(object):

View File

@@ -6874,13 +6874,11 @@ SWIGINTERN PyObject *_wrap__BitmapFromBufferAlpha(PyObject *SWIGUNUSEDPARM(self)
} }
arg2 = static_cast< int >(val2); arg2 = static_cast< int >(val2);
{ {
if (obj2 != Py_None) { if (PyObject_AsReadBuffer(obj2, (const void**)(&arg3), &arg4) == -1) SWIG_fail;
if (!PyArg_Parse(obj2, "t#", &arg3, &arg4)) SWIG_fail;
}
} }
{ {
if (obj3 != Py_None) { if (obj3 != Py_None) {
if (!PyArg_Parse(obj3, "t#", &arg5, &arg6)) SWIG_fail; if (PyObject_AsReadBuffer(obj3, (const void**)(&arg5), &arg6) == -1) SWIG_fail;
} }
} }
{ {
@@ -6924,9 +6922,7 @@ SWIGINTERN PyObject *_wrap__BitmapFromBuffer(PyObject *SWIGUNUSEDPARM(self), PyO
} }
arg2 = static_cast< int >(val2); arg2 = static_cast< int >(val2);
{ {
if (obj2 != Py_None) { if (PyObject_AsReadBuffer(obj2, (const void**)(&arg3), &arg4) == -1) SWIG_fail;
if (!PyArg_Parse(obj2, "t#", &arg3, &arg4)) SWIG_fail;
}
} }
{ {
result = (wxBitmap *)_BitmapFromBuffer(arg1,arg2,arg3,arg4); result = (wxBitmap *)_BitmapFromBuffer(arg1,arg2,arg3,arg4);
@@ -6969,9 +6965,7 @@ SWIGINTERN PyObject *_wrap__BitmapFromBufferRGBA(PyObject *SWIGUNUSEDPARM(self),
} }
arg2 = static_cast< int >(val2); arg2 = static_cast< int >(val2);
{ {
if (obj2 != Py_None) { if (PyObject_AsReadBuffer(obj2, (const void**)(&arg3), &arg4) == -1) SWIG_fail;
if (!PyArg_Parse(obj2, "t#", &arg3, &arg4)) SWIG_fail;
}
} }
{ {
result = (wxBitmap *)_BitmapFromBufferRGBA(arg1,arg2,arg3,arg4); result = (wxBitmap *)_BitmapFromBufferRGBA(arg1,arg2,arg3,arg4);