Now that the typemap is handling buffer-compatible objects correctly
we can drop wrapping the parameters in a buffer() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40912 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1017,12 +1017,11 @@ range -1.0..1.0 where -1.0 is -360 degrees and 1.0 is 360 degrees", "");
|
||||
def ImageFromBuffer(width, height, dataBuffer, alphaBuffer=None):
|
||||
"""
|
||||
Creates a `wx.Image` from the data in dataBuffer. The dataBuffer
|
||||
parameter must be a Python object that implements the buffer interface, or
|
||||
is convertable to a buffer object, such as a string, array, etc. The
|
||||
dataBuffer object is expected to contain a series of RGB bytes and be
|
||||
width*height*3 bytes long. A buffer object can optionally be supplied for
|
||||
the image's alpha channel data, and it is expected to be width*height
|
||||
bytes long.
|
||||
parameter must be a Python object that implements the buffer interface,
|
||||
such as a string, array, etc. The dataBuffer object is expected to
|
||||
contain a series of RGB bytes and be width*height*3 bytes long. A buffer
|
||||
object can optionally be supplied for the image's alpha channel data, and
|
||||
it is expected to be width*height bytes long.
|
||||
|
||||
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
|
||||
@@ -1040,10 +1039,6 @@ def ImageFromBuffer(width, height, dataBuffer, alphaBuffer=None):
|
||||
the objects used for the data and alpha buffers in a way that would cause
|
||||
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._buffer = dataBuffer
|
||||
image._alpha = alphaBuffer
|
||||
|
Reference in New Issue
Block a user