[wxPython-users] speed up display of image data from 3rd party C++
extension
Christopher Barker
Chris.Barker at noaa.gov
Wed Feb 14 13:49:40 PST 2007
F. Oliver Gathmann wrote:
>>> directly using code similar to the recently added BitmapFromBuffer
> Yes, that's what I have in mind - create a wx.Bitmap in my C++ extension
> and pass it to my wxPython GUI for display.
In that case, you don't need wx.BitmapFromBuffer -- you need whatever
the C++ call is for setting the data in a wxBitmap.
> I was thinking of using the buffer interface, but that would still
> involve *two* copies of the image data - one from my C++ image class
> into the buffer (the in-memory layout is different from what wx expects)
> and one from the buffer into the new wx.Bitmap object.
No, it wouldn't. That's the whole point of the buffer interface, when
you create a Bitmap from a buffer, it uses the buffer data directly, it
does not make a copy.
I was suggesting that approach, as it removes the need to have an wx
code in your extension -- that's nice, as you don't have to make sure
you're linked against the same version of wx.
> Yes, I have done that already (and since you can specify strides in
> numpy arrays, you don't have to copy any data at all), but that does not
> solve the problem of getting the image data to the screen in the most
> efficient manner.
True, though we're all hoping that the numpy-style nd-array will become
a standard, and then we can make sure that wxPython functions like
wx.BitmapFromBuffer understand it.
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
More information about the wxpython-users
mailing list