Patch: Cairo/PNG print support

From: Stan Seibert <volsung_at_physics.utexas.edu>
Date: Tue, 19 Apr 2005 22:37:03 -0500


I've posted a preliminary patch to allow TPad::Print to use the cairo vector graphics library to produce PNGs in batch mode (without any X display). The patch is extremely rough (and incomplete) as I'm not very familiar with the TVirtualPS interface or with cairo, but it passes the "squint and compare" test.

http://www.hep.utexas.edu/sno/root_cairo/

I'm curious as to some feedback from the ROOT developers:

  1. Is this the right way to do this in the ROOT framework? I added another TVirtualPS subclass (TCairo) to libPostscript and (hopefully) setup the configure scripts to add TCairo to the build process only if --enable-cairo is present. TPad::Print() should just print a warning if a user tries to use the "cairo" option but cairo support has not been compiled in.

This patch could be a little confusing to use since: c1->Print("test.png")
invokes the usual XImage method, whereas c1->Print("test.png", "cairo")
uses the cairo library.

2. Since the cflags and libs required to link to cairo can be kind of lengthy, I use pkg-config to get them rather than try to guess where they are or have the user input them. Is that acceptable? (It may cause problems for a windows build, where pkg-config would probably not be present.)

3. Fonts have been shrunk a little in this version because I had a problem with them running into the edges of boxes and such. I think this might be because the font cairo is using has a slightly wider spacing than the one ROOT uses. Out of curiosity, where is the width of a given text string calculated to decide on box sizes during histogram painting?

4. Any chance of including this in the ROOT distribution once I fix it up? :)

Bug reports and comments are welcome.

---
Stan Seibert
Received on Wed Apr 20 2005 - 05:37:26 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:07 MET