transparent hatch

Richard Greenwood richard.greenwood at GMAIL.COM
Thu Aug 4 23:34:03 EDT 2005


From: Sean Gillies <sgillies <at> FRII.COM>
Subject: Re: [UMN_MAPSERVER-USERS] transparent hatch
Newsgroups: gmane.comp.gis.mapserver.user
Date: 2005-08-04 22:40:42 GMT (4 hours and 40 minutes ago)

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:
>
> OUTPUTFORMAT
>   NAME jpeg
>   DRIVER "GD/JPEG"
>   MIMETYPE "image/jpeg"
>   IMAGEMODE PC256
>   EXTENSION "jpg"
> END
>
> If I use IMAGEMODE RGB, the space between the vector lines is opaque 
> whie.
>
> My symbol definition:
>
> Symbol
>         NAME 'Diag_NE_SW'
>         TYPE VECTOR
>         POINTS
>                 0 1
>                 1 0
>         END
> END
>
> And my class definition:
>
> 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
>
> Am I overlooking anything? I would prefer to use IMAGEMODE RGB.
>
> Rich


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


Sean,

Thanks for the explanation. Although TRANSPARECNY ALPHA solved the
problem, I found it less that obvious as to why. I mean, what should
transparency have to do with vectors? But your explanation puts it all
in context - the vector hatch gets rendered to a raster, which then
needs transparency if it is not to mask underlying layers.

Hope all is well with you.

Best regards,
-- 
Richard Greenwood
richard.greenwood at gmail.com
www.greenwoodmap.com



More information about the mapserver-users mailing list