AGG changes for MapScript maintainers

Howard Butler hobu.inc at GMAIL.COM
Tue Aug 14 03:09:05 EDT 2007


Tamas,

Should we create our own buffer struct like the gdBuffer that is  
defined in mapscript.i, or should we add the necessary items to  
imageObj to support saving the unsigned char* data on that?  I see  
that imageObj.img currently has unsigned char *raw_byte (I think this  
is used for WCS) .  We would need to add a size_ptr to the img union  
(or use imageObj.size if that is appropriate) and an ownership flag  
to support MapScript.

imageObj already contains a outputFormatObj, so with the additions to  
the struct, our call could look like:

unsigned char* msSaveImageBuffer(imageObj *img);

We then let msFreeImage take care of clean up.

Look ok?

Howard


On Aug 12, 2007, at 4:13 PM, Tamas Szekeres wrote:

> Howard,
>
> I would prefer the policy to keep any of the AGG/GD specific switches
> inside the mapserver core if possible. In this regard we might want to
> establish the corresponding renderer neutral functions like:
>
> unsigned char *msSaveImageBuffer(imageObj *img, int *size_ptr,
> outputFormatObj *format);
>
> void imageFree(imageObj *img);
>
> The latter would wrap gdFree inside. As far as I can see currently
> gdFree is used by both of the renderers. However in the future we'll
> possibly have a renderer specific destroy function for the
> corresponding image that'll make the things more complicated.
>
> Best regards,
>
> Tamas
>
>
>
> 2007/8/12, Howard Butler <hobu.inc at gmail.com>:
>> Language-specific MapScript typemaps or specializations need to be
>> updated to not exclusively use MapServer GD functions.  Previously,
>> the default implementation of getBytes in image.i did:
>>
>> buffer.data = msSaveImageBufferGD(self->img.gd, &buffer.size, self-
>>> format);
>>
>> Additionally, there is now an if test to check for the presence of an
>> AGG driver and use the corresponding method to get the image buffer.
>> If your MapScript language just uses getBytes for all of its buffer/
>> image handling (other than the image.save() method which does not
>> require any swig interface changes), you should be ok.  If you
>> MapScript language has overrides or %extends of imageObj's methods,
>> they will need to be updated to do the following in the case of an
>> AGG format:
>>
>> buffer.data = msSaveImageBufferAGG(self->img.gd, &buffer.size, self-
>>> format);
>>
>> I have updated some of the Python extensions (I do not have its
>> image.write() done yet for AGG), and a quick browse showed at least
>> C# with some overrides that need to be updated.  Java and Ruby too?
>> Hopefully we can the necessary changes in before the next beta as
>> more folks start testing MapServer 5.0 to make pretty pictures :)
>>
>> Howard
>>



More information about the mapserver-dev mailing list