[GRASS-dev] raster offset with cairo driver

Glynn Clements glynn at gclements.plus.com
Wed Nov 28 01:42:40 EST 2007


Lars Ahlzen wrote:

> >> raster offset and fonts now look ok, good stuff guys.
> >>
> >> I've updated the fancy example on the wiki page to show off the fancy compass:
> >>  http://grass.gdf-hannover.de/wiki/Cairo_driver#Examples
> >>
> >>
> >> d.out.file now has added support for ps, svg, and pdf by way of the Cairo
> >> driver.
> >>
> >> but it doesn't work, I get output like this for the simple spearfish example:
> > 
> > [snip]
> > 
> > It works for me. Where "works" means "renders everything then dumps
> > the resulting raster image to a 14MiB PostScript file".
> 
> Cairo does have an unfortunate tendency to sometimes render to raster 
> and embed that into the requested format, presumably as some kind of 
> "last resort" when it (or the selected format) doesn't support some 
> drawing operation.
> 
> I haven't done enough testing to figure out exactly when this happens or 
> what triggers it.

Found it. GRASS_TRANSPARENT=TRUE causes the raster fallback. Not
really surprising when you think about it.

> > Well, that rules out using cairo for the core of the 7.x graphics
> > architecture.
> 
> Perhaps. Then again,

After having done several tests without ever getting it to produce
vector (i.e. not pre-rendered) output, I had concluded that the
PostScript backend was "faking it".

Removing the GRASS_TRANSPARENT=TRUE from my environment results in
genuine vector output, at least if you only use vector output

However, the output of d.rast is pre-rendered (the output is much
larger than it should be), and any following d.vect commands are also
pre-rendered.

Also, the PostScript which it generates for rasters is suboptimal to
say the least. It stores the raster data as a string and decodes it
from there, rather than streaming from currentfile. This is likely to
present a problem for printing large rasters; unlike desktop systems,
printers typically don't have gigabytes of RAM.

So, it's still not able to obsolete the PS driver. Initially, this
isn't likely to be a problem; cairo's drawing model is close enough to
PostScript that it would be feasible to maintain both drivers in the
short term.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list