Problems upgrading to mpl 0.87.4

Matplotlib didn't used to link against the wxpython

    > c-api. The recent versions are linked against the
    > unicode version of wx, not the ansi. You can install the
    > unicode version. We are trying to decide how to handle
    > this.

On some backends, eg qt, we can do the blit via python method calls
and python buffer objects. I know this can be done w/ pygtk and it
has been on my wishlist to remove the gtk extension code and use pure
python since getting rid of gtk, wx and tk devel headers and libs at
build time would significantly reduce the kinds of cross-platform
build and runtime issues we are seeing from this GUI dependent
extension code.

Charlie, since you are pretty familiar with the blitting API, perhaps
you could take a look and see how much work it would be to do wx
blitting w/o extension code. I'd be happy to add some additional
helper methods in agg if need be, as we did for qt. I'd be willing to
trade a little performance to avoid these distribution headaches.

JDH

John Hunter wrote:

Charlie, since you are pretty familiar with the blitting API, perhaps
you could take a look and see how much work it would be to do wx
blitting w/o extension code. I'd be happy to add some additional
helper methods in agg if need be, as we did for qt.

Didn't MPL originally use the Python API, but with less than stellar performance? I'm not sure how efficient we can get without making changes to wx. However, I think Robin Dunn is pretty open to making some of those changes.

For one, he told me a while back that he was going to try to expose some of the API for working directly with wxBitmaps. If we could dump data straight into a wxBitmap, that would be the best option. That's likely to be tricky, however, as a wxBitmap is a wrapper around whatever the platform-native format is for a Bitmap. However, while there are a lot of possible formats for native Bitmaps, 24bit RGB is pretty darn common, if we could get top performance from that from that format, we'd be a long way in the right direction.

Another (or additional) option is for both MPL and wx to support the new array interface protocol in numpy. There's a lot of other reasons to do that, and, again, Robin has expressed his support for this. If we could get MPL, wx, numpy, and PIL all passing data around with this protocol, we'd be in great shape. Travis posted a patch to PIL for support a while back, I don't know if it's going to get applied or not, but it's worth looking at.

Another place to look for idea is Enthought's Kiva -- It's Agg back-end interacts well with wx -- or so I've heard. I haven't tried it yet myself.

I'm no C++ wiz, but I'd be willing to help with the wx modifications -- it's been on my list for a while. Should I send a note to Robin Dunn for ideas?

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer
                                         
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...259...

Looks like it has been added already. From

http://effbot.org/zone/pil-changes-116.htm

- Added "fromarray" function, which takes an object implementing the
  NumPy array interface and creates a PIL Image from it. (from Travis
  Oliphant).

- Added NumPy array interface support (__array_interface__) to the
  Image class (based on code by Travis Oliphant). This allows you to
  easily convert between PIL image memories and NumPy arrays:

import numpy, Image

i = Image.open('lena.jpg')
a = numpy.asarray(i) # a is readonly
i = Image.fromarray(a)

Regards
Stéfan

···

On Mon, Aug 14, 2006 at 11:12:29AM -0700, Christopher Barker wrote:

Another (or additional) option is for both MPL and wx to support the new
array interface protocol in numpy. There's a lot of other reasons to do
that, and, again, Robin has expressed his support for this. If we could
get MPL, wx, numpy, and PIL all passing data around with this protocol,
we'd be in great shape. Travis posted a patch to PIL for support a while
back, I don't know if it's going to get applied or not, but it's worth
looking at.