[GRASS-dev] raster offset with cairo driver

Hamish hamish_nospam at yahoo.com
Thu Nov 22 05:04:48 EST 2007


Hi,

I'm trying out the new Cairo driver. To make things easier I just added  support for it to d.out.file: use the -c flag with a raster image format.

As AFAICT there is no user documentation, so I also added a small wiki page for it:  http://grass.gdf-hannover.de/wiki/Cairo_driver

It is missing a display/drivers/cairo/description.html page, modeled after the equivalent PNG driver page.


There's a problem in that the raster data is being rendered offset vs. the vector data. For a window with the same aspect ratio as the region it seems to line up ok. Else, not.

e.g.
export GRASS_WIDTH=720
export GRASS_HEIGHT=585
d.mon x0
d.rast map=elevation.10m
d.vect map=streams width=1 color=blue
d.vect map=roads width=2

d.out.file -c sf_cairo format=png size=800,800

# even more dramatic
d.out.file -c sf_cairo1 format=png size=400,800
d.out.file -c sf_cairo3 format=png size=800,400


?
example:  http://bambi.otago.ac.nz/hamish/grass/bugs/sf_cairo1.png


There's another problem with fonts- True/FreeType fonts gets scrambled.
This reminds me of a long ago bug in d.text.freetype, fixed in rev 1.42.
"use correct pitch for reading bitmap buffer & fix scrambled letters"
 http://freegis.org/cgi-bin/viewcvs.cgi/grass6/display/d.text.freetype/main.c

example:  http://bambi.otago.ac.nz/hamish/grass/bugs/sf_cairo2.png
 (d.* commands given on the above wiki page)


Hamish


More information about the grass-dev mailing list