[Mapserver-users] Color allocation in Mapserver 4.0 8bit mode, possible bug

Claude Philipona claude-mapserver at skirando.ch
Tue Sep 23 14:12:29 EDT 2003


Hello,

Migrating an application (http://map.epfl.ch) from 3.6 version to 4.0, I
was to a different behaviour in colors allocation.

We have a several vector layers of colored polygons representing buildings
and rooms, each buildings level stacking together with transperency. On top
of that, there are several layers that should appear in gray/black.

With version 3.6, the image generated by mapserver didn't eat all the 256
colors of the colormap before the handling of labels (even with the all the
colors generated by the multi levels transparency processing on the
layers), and the labels were properly rendered.

With version 4.0, the colors of the label changes evreytime you change
location/zoom, since all the 256 colors are eaten just by the transparency
process. When the colors of the surroundings polygon are in the blue
shades, labels appears in blue, when in green, labels appear in green,...

You can see the difference between these two images produced with the exact
same mapfile:

mapserver 3.6:
http://www.camptocamp.com/~claude/mapserver/demo_mapserver_36.gif
(notice label in black as it should be)

mapserver 4.0:
http://www.camptocamp.com/~claude/mapserver/demo_mapserver_40.gif
(notice text in green, but wanted in black)

Why is the behaviouor different? Is it a bug?

With 4.0, I could use RBG output, but it is not quite appropriate for this
kind of data: jpeg give poor images for a reasonable size and PNG24 are
double the size of gif or png8. So I really want to stick to 8bit mode.

As there is no COLOR_MATCH_THRESHOLD for transparency processing on vector
data, I'm using a workaournd for now:
I'm using a fake layer (hidden by other layer), as first layer containing
polygons covering the whole extent, with colors set to populate right at
the beginning the colors needed for labels and symbols. It works fine, but
it is not a very nice way to handle this problem.

As this application is quite heavy (>10'000 line mapfile), it is a good
test sample. During the migration, I discoverd several little problem, I
will give reports to the list on each of these next few days.

Thanks,

Claude



More information about the mapserver-users mailing list