[GRASS-dev] Cairo monitor driver

Glynn Clements glynn at gclements.plus.com
Sun Oct 14 22:48:01 EDT 2007

Lars Ahlzen wrote:

> >> * High quality antialiased output. See 
> >> http://lars.ahlzen.com/cairograss/ for a few simple examples and a 
> >> comparison with the PNG driver.
> > 
> > One thing to be careful of with anti-aliasing is tesselations. Issues
> > with Ghostscript's anti-aliasing option are a regular topic on the GMT
> > list.
> Good point.
> I don't know how well this driver handles that. During my own use i 
> haven't *noticed* any issues, but you or some one else might have good 
> test cases to try once I post the code.

Take a map with many adjoining polygons, e.g. "soils" from spearfish,
then assign colours such that adjacent polygons have the same colour. 
Anti-aliasing will produce visible lines between polygons.

It needs to be borne in mind that anti-aliasing edges is a "hack". 
Sometimes it works, sometimes it doesn't. When it doesn't, you need to
to either use oversampling or to simply disable it.

> > If Cairo is available for both Windows and MacOSX (natively, i.e. not
> > requiring X11), and does an adequate job of PostScript generation
> > (embedding a pre-rendered image in a PostScript file doesn't count),
> > it could be a viable basis for the new graphics architecture.
> It is native cross-platform. According to the docs, it even uses 
> hardware acceleration where available.
> And yes, it produces real, actual vector output (PS, PDF and supposedly 
> SVG although I had some issues with that), not just a bitmap with a 
> PS/PDF header. There are some PDF examples rendered with the CAIRO GRASS 
> driver at http://lars.ahlzen.com/cairograss/

I've read up a bit about Cairo today. I note that it has a mechanism
to fall back to rasterisation for operations which can't be
implemented by vector targets (surfaces).

In some situations, that may be useful; in others, it will be a
nuisance. In particular, it doesn't mean that GRASS can just forget
about vector targets and leave it to Cairo.

One of the main areas where this is relevant is if we want translucent
layers. It's possible to simulate translucency in PostScript using
pattern fills, but you need to be careful when selecting the grid
(frequency, phase, orientation) or else you can get artifacts.

It gets complex if you want more than one translucent layer, as you
have to plan all of the layers in advance (i.e. when drawing the
intermediate layers, you have to allow for layers which will be drawn
on top).

Glynn Clements <glynn at gclements.plus.com>

More information about the grass-dev mailing list