We've been looking at implementing ticket
320<http://trac.mapnik.org/ticket/320>to add SVG symbolizers. I
wondered if anyone else has feedback before we go
ahead and write code? Here's the plan:
1. Read SVG symbols:
- SVG parsing using Gnome's librsvg <http://librsvg.sourceforge.net/>
2. Image rendering abstraction to get away from
ImageData?<http://trac.mapnik.org/wiki/ImageData>32
(the current "symbol" data class):
- Something like an
AbstractImage?<http://trac.mapnik.org/wiki/AbstractImage>class,
wrapping width, height and rendering functions (
ImageData? <http://trac.mapnik.org/wiki/ImageData>32 and
VectorImage?<http://trac.mapnik.org/wiki/VectorImage>can derive from
this)
- Make calls to point_symbolizer.get_image() return an
AbstractImage?<http://trac.mapnik.org/wiki/AbstractImage>(i.e. a
VectorImage? <http://trac.mapnik.org/wiki/VectorImage> for SVG
symbolizers, and a ImageData? <http://trac.mapnik.org/wiki/ImageData>32
for raster symbolizers)
3. Actually render the vector data:
- Overload Mapnik's cairo_context::add_image() for
VectorImage?<http://trac.mapnik.org/wiki/VectorImage>to render the
abstracted image as a cairo surface instead of raster data.
librsvg can already draw into a cairo surface.
- Initially make the AGG renderer rely on Cairo for SVG rendering. If
someone really wants to make this cleaner they could extend librsvg to
render to AGG. That looks like too much work for little gain at
the moment.
So, we could:
- Render a surface using Cairo
- Rasterize surface and pass it back to AGG as an
ImageData?<http://trac.mapnik.org/wiki/ImageData>32
This means:
- SVG symbol support would depend on both librsvg and cairo
- It'd be a backwards-compatible extension of the existing way to use
images, by adding support for type=SVG in addition to existing PNG support.
- It'll apply to both point and shield symbolizers
Thanks and regards
Craig de Stigter
--
Koordinates Ltd
PO Box 1604, Shortland St, Auckland, New Zealand
Phone +64-9-966 0433 Fax +64-9-969 0045
Web http://www.koordinates.com
_______________________________________________
Mapnik-devel mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-devel