Hi Steve, Eric, John,

On Sunday 07 January 2007 04:44, Steve Chaplin wrote:
> On Sat, 2007-01-06 at 09:23 -1000, Eric Firing wrote:
> > Steve,
> >
> > Darren Dale raised a question offline that I think will be of general
> > interest to mpl devels, and that you are the person to answer:
> >
> > How do you see the future of a cairo backend as a prospective
> > replacement for most or all of the primary mpl backends?
>
> I think cairo could potentially be used to replace the pdf, ps, svg
> and gdk/gtk backends which would unify most of the backends and simplify
> a lot of the code.

This would really be a plus. The option to use latex for text layout would 
have to be completely reworked, if it could be supported at all. Not that 
this is a critical feature, but in my opinion it is still necessary at this 
point for producing the highest quality plots for publication.

> > What would need to be completed in cairo? Based on the cairo web page, I
> > get the impression that quite a bit is still missing, including eps
> > generation and genuine vector ps.  But maybe the web page is just out of
> > date.
>
> Which web page is out of date? Where does it mention eps and ps, I
> couldn't find it.
>
> My general impression of the cairo "surfaces" is:
> ImageSurface/png - support is very good
> gtk/xlib - support is very good
> ps/pdf/svg are usable but less mature and still developing so there may
>             be occasional problems drawing specific items
> ps - it used to embed bitmap images but now most output is vector based
> eps - is not supported yet, but may be in a future version
>
> > What would need to be done in mpl, and how hard would it be?
>
> The cairo backend can already be used for png, ps, pdf and gtk output so
> I don't think there would be much to do. Mostly, it needs testing -
> running all the mpl examples and checking the output looks OK.

I had to alter the following lines from backend_gtkcairo, from 

import matplotlib.backends.backend_cairo as be_cairo
from   matplotlib.backends.backend_gtk import *

to

import backend_cairo as be_cairo
from   backend_gtk import *

in order to prevent the following traceback:

Traceback (most recent call last):
  File "/usr/bin/ipython", line 27, in ?
    IPython.Shell.start().mainloop()
  File "/usr/lib64/python2.4/site-packages/IPython/Shell.py", line 1034, in 
start
    return shell(user_ns = user_ns)
  File "/usr/lib64/python2.4/site-packages/IPython/Shell.py", line 945, in 
__init__
    shell_class=MatplotlibMTShell)
  File "/usr/lib64/python2.4/site-packages/IPython/Shell.py", line 622, in 
__init__
    on_kill=[mainquit])
  File "/usr/lib64/python2.4/site-packages/IPython/ipmaker.py", line 90, in 
make_IPython
    embedded=embedded,**kw)
  File "/usr/lib64/python2.4/site-packages/IPython/Shell.py", line 506, in 
__init__
    user_ns,b2 = self._matplotlib_config(name,user_ns)
  File "/usr/lib64/python2.4/site-packages/IPython/Shell.py", line 397, in 
_matplotlib_config
    from matplotlib import backends
  File "/usr/lib64/python2.4/site-packages/matplotlib/backends/__init__.py", 
line 55, in ?
    new_figure_manager, draw_if_interactive, show = pylab_setup()
  File "/usr/lib64/python2.4/site-packages/matplotlib/backends/__init__.py", 
line 23, in pylab_setup
    globals(),locals(),[backend_name])
  
File 
"/usr/lib64/python2.4/site-packages/matplotlib/backends/backend_gtkcairo.py", 
line 11, in ?
    import matplotlib.backends.backend_cairo as be_cairo
AttributeError: 'module' object has no attribute 'backends'


I only had a short time to work with backend_gtkcairo, but a couple of things 
caught my attention. mathtext support seemed to need some improvement, it 
looked like it was rendered as an image rather than as text. Also, 
imshow(rand(100,100)) looked very different with gtkcairo and gtkagg, (maybe 
because the rgba ordering is different in agg and cairo? I'm not sure this is 
even the case, I'm taking a stab in the dark.)


> > Would mpl get slower if everything went through cairo?
>
> Not sure, you would need to run cairo and test it. It used to be much
> slower than Agg but more recent versions have had many optimisations
> applied and the difference is much smaller now.
>
> > Any other considerations?
>
> Some parts of mpl are Agg-specific and other parts (the whole drawing
> model) are designed around the gdk drawing style - this makes things harder
> and inefficient when using cairo.

I'm just thinking out loud here, brainstorming, but may be getting completely 
ahead of myself. Feel free to tell me so. If we made a mpl-pre1.0 branch, and 
reconstructed the drawing model, how much work are we talking about? Since 
gtk includes cairo now, couldn't a single gtk backend replace both gtk and 
gtkagg, while retaining the speed of the pure gtk backend?

> On Sat, 2007-01-06 at 09:36 -1000, Eric Firing wrote:
> > One more question: how does the image quality of cairo compare to
> > Agg?
> > Is the antialiasing as good?
>
> Image quality looks OK to me, but I'm no expert.
>
> The web browser Firefox 3.0 (due to be released early in 2007) will use
> cairo for all rendering. Firefox requires a high level of graphics
> performance and the upcoming cairo 1.4 release is expected to provide
> that.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to