I've spent some more time working on the idea of using a common image
renderer for the GUIs. As I mentioned before, this will remain
optional so no need to be concerned about losing support for the
current GTK or WX backend, but this will enable us to add capabilities
to the GUI backends that they may not natively support.
I've been working on the GTKGD backend as a testbed since we already
have the GUI architecture in GTK and the drawing architecture in GD.
This already backend provides additional capabilities to GTK, namely
antialiased lines and arbitrary text rotation. I wrote some C code to
transfer the image from GD->GTK so it is now fast enough to be usable,
though not as fast as the native GTK solution. There are some
performance bottlenecks in GD that I've identified in the profiler so
the current speed can be improved.
David Moore has implemented a paint backend (a libart wrapper).
libart is a sophisticated render engine that is currently used as the
renderer for Gnome Canvas and is ported to all the major platforms.
Although he is waiting on some paint patches he applied to be
incorporated, this provides another candidate backend for a common
I've updated CVS. In setup.py there is a line 'if 0' that needs to be
replaced with 'if 1' to compile the extension module (does anybody
know how to set flags for distutils?) The GTKGD backend now passes
all the regression tests (though there is a color allocation but that
seems to be a gdmodule problem) and serves as a template for GUI
implementers who want to get something up and running fast. With this
approach, the backend writer does not need to implement either a
Renderer or a GraphicsContext. Once you have the GUI architecture
setup, adding a different image renderer is as simple as doing a
importing a different FigureCanvasBackend and writing an image->gui
canvas transfer function.
If there are any brave souls who want to test this out and working,
I'd be much obliged. You'll need the requirements for the GTK and GD
backends installed as described on
http://matplotlib.sourceforge.net/backends.html, including the
gdmodule patch. Let me know if you encounter any compile problems.