[GRASS-dev] Cairo monitor driver
glynn at gclements.plus.com
Sun Oct 14 14:36:49 EDT 2007
Lars Ahlzen wrote:
> My apologies if this has been done and/or discussed before, but a search
> of grass-dev came up empty.
> Since the Cairo graphics library (http://www.cairographics.org, LGPL
> licensed) provides very high-quality graphics output in several vector
> and raster formats, I thought it would make sense to create a "pseudo"
> monitor driver for it (similar to the PNG and PS drivers). So I did.
> Cairo does all of the hard work, so it's really mostly simple "glue" code.
> It seems stable, and is fairly complete in terms of features. I've used
> for most of my own work recently.
> Benefits include:
> * 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
> * Several output format options, both vector and bitmap. The driver
> currently supports PNG, PDF, PS and SVG. Output to X or Win32 windows
> might be possible in the future, since Cairo supports such formats as well.
> Of course, such niceness comes at a price. It takes longer to draw
> complex vector data, compared to the PNG driver. However, I imagine that
> in most cases drawing is not the main bottleneck anyway.
For d.vect, drawing usually is the bottleneck.
> Also, it obviously pulls in Cairo as an additional dependency. Cairo is
> probably found on most systems nowadays, though, since many other
> applications (including some mapping and GIS software) already use it.
> Additionally, the fact that GRASS monitors (unfortunately) receive
> integer data (screen coordinates, line widths, etc) somewhat limits the
> effectiveness of the high-precision output from the CAIRO driver. For
> example, in the "Massachusetts Counties and roads" example, the
> antialiasing breaks down for certain lines because they are divided into
> smaller segments whose coordinates are rounded before they are drawn.
> Similarly, zooming in on vector output will also reveal this drawback.
> My main question is: Does all of this seem useful to anyone else? I do
> realize that most of these things can be achieved in other ways, but
> I've personally found this driver to produce high quality output in a
> very convenient way. Feedback is appreciated!
The main thing to bear in mind is that the graphics system is going to
be completely re-written for 7.x.
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.
> I can of course post code too, if anyone would be interested in actually
> trying it.
The code would certainly be useful.
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev