[mapserver-dev] A Question

Daniel Morissette dmorissette at mapgears.com
Mon Aug 3 12:15:21 EDT 2009


kiran varma wrote:
> Can any one help me regarding the conversion of the internal AGG pixmap 
> format to gdImagePtr? Just a pointer in the right direction will do :-)
> 

Perhaps a good starting point would be msImageCreateAGG() in mapagg.cpp?

The function creates a GD image and binds it to the AGG renderer. You 
could possibly do a similar thing when rendering your SVG symbols with 
the agg_svg* code: create a GD image, bind it to a AGG renderer so that 
it renders to the GD buffers, and then use that AGG renderer to render 
the SVG symbol into it... rendering to the GD buffers at the same time.

I'm not an AGG expert, so I'm not sure how to adapt the agg_svg_* code 
to do something like this. Hopefully Thomas can provide some hints, 
otherwise that will be your challenge to work on in the next couple of 
days.  ;)


BTW, about the integration of SVG symbol support in MapServer, I think 
for a first pass you could could concentrate on making things work for 
GD only and do not need to worry about caching the symbols yet. Then 
once basic GD support is working you can look at adding this to 
mapagg.cpp as well and adding caching.

For the GD renderer integration, you could look at how mapgd.c uses 
createBrush() to turn vector symbols into a gdImagePtr and do a similar 
thing:

- Implement a createBrushFromSVG() function in mapgd.c that renders a 
SVG symbol and returns a gdImagePtr

- Add a case for MS_SYMBOL_SVG in all rendering functions in mapgd.c 
which calls your createBrushFromSVG() and then passes the gdImagePtr to 
the appropriate GD functions in a way similar to what is currently done 
for VECTOR or PIXMAP symbols at the moment.

When time comes to add caching, you could have a look at addImageCache() 
and searchImageCache() in mapgd.c for examples of how the image cache 
works for vector symbols, you could possibly even reuse those functions.

Daniel
-- 
Daniel Morissette
http://www.mapgears.com/


More information about the mapserver-dev mailing list