On mapserver-dev I have written the following with regard to use of -1 -1 -1 for transparent. I will note that -255 -255 -255 in the map file works fine as a transparent color for raster classes.
In bug 1806 there is a report that COLOR -1 -1 -1 is not being treated as
transparent when classifying raster data. Investigating I find that the
code is checking for transparent as -255 -255 -255 using:
#define MS_TRANSPARENT_COLOR(color) (((color).red==-255 (color).green==-255 | (color).blue==-255)?MS_TRUE:MS_FALSE)
|
In fact, -1 -1 -1 is the default value to which colors are initialized
and it is considered "invalid" according to:
#define MS_VALID_COLOR(color) (((color).red==-1 (color).green==-1 | (color).blue==-1)?MS_FALSE:MS_TRUE)
|
I have found no material discussing such color values in the reference
documentation, though the mapserver tutorial does suggest using -1 -1 -1
as a color for classified data to make it transparent.
The vector code likely does effectively treat this as transparent, but
the raster code treats invalid, but not transparent as a special case meaning
use the underlying color of the raster data instead of applying a color
based on classification. I hesitate to break this capability by treating
invalid as transparent.
Also, I find in the mapsymbol.h include file that colorObj now has an
alpha field. I'm not clear on how widely this is being used, or whether it
is intended to be the "future" of transparency.
Should we document -255 -255 -255 as transparent? Promote use of alpha?