transparent hatch

Sean Gillies sgillies at FRII.COM
Thu Aug 4 15:40:42 PDT 2005


On Aug 4, 2005, at 4:17 PM, Frank Warmerdam wrote:

> On 8/4/05, Richard Greenwood <richard.greenwood at gmail.com> wrote:
>> Since Mapserver 4.4, when I want to output jpegs, if I want a simple
>> vector hatch to be transparent (for underlying layer to show thru) I
>> have to set IMAGEMODE PC256:
>> =20
>> OUTPUTFORMAT
>>   NAME jpeg
>>   DRIVER "GD/JPEG"
>>   MIMETYPE "image/jpeg"
>>   IMAGEMODE PC256
>>   EXTENSION "jpg"
>> END
>> =20
>> If I use IMAGEMODE RGB, the space between the vector lines is opaque 
>> whit=
> e.
>> =20
>> My symbol definition:
>> =20
>> Symbol
>>         NAME 'Diag_NE_SW'
>>         TYPE VECTOR
>>         POINTS
>>                 0 1
>>                 1 0
>>         END
>> END
>> =20
>> And my class definition:
>> =20
>> CLASS
>>         NAME "FEMA 500 Year Flood Zone SHX"
>>         EXPRESSION 'SHX'
>>         STYLE
>>                 COLOR 112 186 248
>>                 OUTLINECOLOR 0 0 255
>>                 SYMBOL 'Diag_NE_SW'
>>                 SIZE 20
>>         END
>> END
>> =20
>> Am I overlooking anything? I would prefer to use IMAGEMODE RGB.
>
> Rich,=20
>
> Try adding a "TRANSPARENT ALPHA" line in your layer definition.
> Amoung other things this enables the alpha blending needed for
> raster symbols with transparency. =20
>
> I'm not really satisfied with this requirement, though it is organized
> this way partly to avoid extra work in the common case where there
> is no transparency.
>

Originally I thought this was a different issue, but indeed MapServer's 
vector type symbols are first rendered into pixmaps. Pixmap 
transparency for RGB imagemodes was on in versions prior to 4.2, and 
then was broken in 4.2, presumably in an attempt to increase 
performance. I restored it in 4.4.2 and 4.6, controlled by the layer 
transparency keyword instead of adding another transparency keyword to 
the symbol definition. It might be better to define transparency for 
symbols instead of layers, but this would require a fair amount of 
rewriting.

cheers,
Sean

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



More information about the MapServer-users mailing list