Want to get gd handle after mapscript rendering is complete

Sean Gillies sgillies at FRII.COM
Thu Nov 17 09:34:51 EST 2005


On Nov 17, 2005, at 12:37 AM, Karl Lehenbauer wrote:

> 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...
>
> Karl

Karl,

I take it that you want to use the imageObj's gdImagePtr with gdtcl?

There is a imageObj.getBytes() method in place that is fully  
implemented for Python, Java, and C# that we use for those languages  
because we're not using GD-based graphic programs. That also makes  
development a bit easier because after you call getBytes you don't  
have to keep track of the imageObj, you can let it go out of scope.

Is that an option for you? Create a new tcl GD object using the  
output of getBytes?

cheers,

---
Sean Gillies
sgillies at frii dot com
http://zcologia.com/news



More information about the mapserver-dev mailing list