Want to get gd handle after mapscript rendering is complete

Karl Lehenbauer karl-mapserver at SC.COM
Thu Nov 17 02:37:12 EST 2005

Hi...   First of all, three cheers to the Mapserver development team!

Rather than emitting a map image to a file or to memory, I'd like to  
get 'hold of the gdImagePtr and take it from there on my own.

For example, using Tcl, I have a gdIOCtx handler that lets me write a  
gd image directly to a socket.

I know very little about swig, so I am really winging it here.  I  
tried adding

     gdImagePtr gdHandle()
         return self->img.gd;

...to mapscript/swiginc/image.i, and the results will actually  
compile, but it wraps up a Tcl interface (in my case) for map images  
called gdHandle instantiates a Tcl object containing the contents of  
the gdImagePtr structure.  This isn't what I want.

Really what I want is to add a new method to the mapscript image  
class that will invoke

	tclgd_newGDObject (Tcl_Interp *interp, Tcl_Obj *nameObj, gdImagePtr im)

where nameObj is an argument passed through the method invocation and  
im is set to self->img.gd, so invoking

     $image gdHandle frammistan

...would invoke tclgd_newGDObject(interp, Tcl_NewStringObj  
("frammistan", -1), self->img.gd); and return "frammistan" (because  
if I pass "#auto" as the name, like incrTcl, it returns a unique  
command handle.)

Then I can do all my gd magic using my "frammistan" command.

Anyone got a quick solution or a pointer for where to look?  Thanks  
in advance...


More information about the mapserver-dev mailing list