[Mapserver-dev] Re: 24-bit output errors?

Frank Warmerdam warmerdam at pobox.com
Tue Jun 10 14:22:52 EDT 2003


Steve Lime wrote:
> Hi Frank: Missed you at the conference. It was a good time. Just for my own sake, what did I
> screw up with this bug? I'd been preoccupied with the conference and not paying close 
> attention.


Steve,

The bug was that the background areas of drawn fonts in 24bit maps were
sometimes screwed up.   Something similar came up recently with in-image
legends.

To the best of my knowledge it isn't your fault.  Arguable mine, or just
an untested area.  Basically, in 24bit mode if you want the "gd" services
to support transparency properly alpha blending needs to be turned on.  But
for much of the "raster" portion of the processing we want this turned off
as I explicitly do the blending and transparency.

So when depending on gd libraries to overlay bitmaps, symbols or fonts
turn on alpha blend, but turn it back off when done.

eg.

     if( gdImageTrueColor(img) )
     {
         oldAlphaBlending = img->alphaBlendingFlag;
         gdImageAlphaBlending( img, 1 );
     }
     gdImageStringFT(img, bbox, 
((label->antialias)?(label->color.pen):-(label->color.pen)), font, size, 
angle_radians, x, y, string);

     if( gdImageTrueColor(img) )
         gdImageAlphaBlending( img, oldAlphaBlending );

I didn't understand all this well originally (and the gd alpha blending
didn't work well in early 2.0.x versions) so I disabled alpha blending to
control it myself, and since have had to patch up various spots to do
this right in mapgd.c.   Perhaps we should have it on all the time and
I should completely avoid using the gd mixing macros/functions in the
raster code.  However, for now I have just turned it on locally (like above)
in various spots.

I think we need to keep an eye out for other services like this in mapgd.c
and fix up as they come up.

PS. I would have loved to have been at the MUM.  I am sure it was a blast.
But I have had to severely curtail my travelling lately as my wife is working
alot.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent





More information about the mapserver-dev mailing list