[GRASS-dev] raster offset with cairo driver
Glynn Clements
glynn at gclements.plus.com
Thu Nov 22 17:07:55 EST 2007
Glynn Clements wrote:
> > 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.
>
> The code overlooks the fact that the top-left coordinates are
> subjected to the scaling.
>
> I should have a fix shortly.
Fixed in CVS.
> > 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)
>
> I was looking into this; it appears that I forgot about it.
This appears to be a cairo bug. It doesn't appear to like using
surfaces whose strides aren't multiples of four as sources.
Dumping the surface to a PNG file with cairo_surface_write_to_png()
shows the correct data, but using the surface as a source for
cairo_mask_surface(), cairo_set_source_surface() etc produces garbled
output. This doesn't affect ARGB surfaces, which are always word
aligned.
I've added a workaround in CVS.
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev
mailing list