Re: Patch: Cairo/PNG print support

From: Valeriy Onuchin <>
Date: Wed, 20 Apr 2005 12:08:46 +0200

Hi Stan, thanks.
It's very intersting and "in-time" work. I'm working on the same task right now (probably re-inventing the wheel), i.e. adding vector graphics to TASImage class and writing a class derived from TVirtualPS which draws postcript graphics over TImage. It will support not only PNG, but many other formats, e.g. GIF, TIF, JPEG etc.

I looked some time before for possibilities to avoid "re-inventing the wheel".

Two conditates were considered:
1. Cairo

Cairo (version 0.3.0) minuses
- no port to win32. Cairo page says about possibility to create Win32 GDI beckend,   but actually "the page" is empty.   There is no win32 makefile or project file inside Cairo dist. - Cairo itself has many extra dependencies on

- only PNG image format support
- license (??) - either the GNU Lesser General Public License (LGPL)   or the Mozilla Public License (MPL)

There are many Cairo pluses
1. first of all, it's a "mainstream" supported by, GNOME

   Most probably, very soon Cairo will be a part of any "normal" linux    distributive. Since of its "political place"    the Cairo project is connected with other ( projects,    i.g. X Render extension, OpenGL X, virtual framebuffer etc.

2. possibility to "plugin" different beckends, e.g. OpenGL (glitz)
3. PDF 1.4 imaging model
4. ... many others such as antialiesed graphics etc.

For me, antigrain is more attractive because it's lighter, more powerfull, with no dependencies, no license issues.

Anyway, adding dependency on any other package should be considered very carefully. I will discuss these issues (Cairo, antigrain) inside the root team (today).

Regards. Valeriy

I already looked at

Stan Seibert wrote:

> 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.
> 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 - 12:08:53 MEST

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