Opened 17 years ago

Closed 17 years ago

#2052 closed defect (fixed)

compiling mapfile.c with ALPHACOLOR_ENABLED fails due to formating issues

Reported by: simon.kammerer@… Owned by: dmorissette
Priority: high Milestone:
Component: Build Problems Version: 4.8
Severity: normal Keywords:
Cc: jnovak@…

Description

Around line 1615:

#if ALPHACOLOR_ENABLED
  if( label->color.alpha )
	writeColorWithAlpha(&(label->color), stream, "  ALPHACOLOR", tab);
  Else
#endif
	writeColor(&(label->color), stream, "  COLOR", tab);

fails to compile when ALPHACOLOR_ENABLED flag is set.

Something like:

#if ALPHACOLOR_ENABLED
  if( label->color.alpha ){
   writeColorWithAlpha(&(label->color), stream, "  ALPHACOLOR", tab);
  }
  else{
   writeColor(&(label->color), stream, "  COLOR", tab);
  }
#endif

compiles well and seems to have no side-effects on mapserver.

Best regards
Simon

Change History (7)

comment:1 by dmorissette, 17 years ago

Cc: warmerdam@… steve.lime@… added
Owner: changed from mapserverbugs to dmorissette
I have fixed the "Else" (changed to "else") in the current CVS HEAD version
(4.99), but I don't think this ALPHACOLOR_ENABLED code does anything, how did
you enable it and why?

When I asked about this ALPHACOLOR_ENABLED flag I got the following answer from
Steve:
(from http://lists.gis.umn.edu/pipermail/mapserver-dev/2003-November.txt)

Steve Lime wrote:
> I believe Frank put that in place at the begining of the color
> conversion. Not sure
> what his intensions were, but I've not modified any of the GD related
> code to use
> it. No reason to document it at this point.
> 
> Steve

Adding Steve and Frank to CC to get a status update on this.

comment:2 by fwarmerdam, 17 years ago

I don't think it was me.  Looking at the logs it seems I have not touched
mapfile.c since 2004 when I setup the standard headers. 

comment:3 by fwarmerdam, 17 years ago

OK, my search for my own name was wrong, and I have done a few commits. 
But this still does not ring a bell as anything I worked on, or had 
thoughts on. 

comment:4 by simon.kammerer@…, 17 years ago

With ALPHACOLOR_ENABLED (FLAGS =  -DALPHACOLOR_ENABLED ... in the Makefile) you
can assign alpha values to colorObj. ( loadColorWithAlpha() )
I enabled it because I'm playing around with SWF (flash) output and with
ALPHACOLOR_ENABLED I can create highlighting buttons (=shapes in layers) with
transparency. However, I had to define a new parameter in the CLASS section of a
mapfile (HIGHLIGHTCOLOR 255 0 0 150). Very early alpha development stage, and my
first contact with real-life c-code...

comment:5 by dmorissette, 17 years ago

Cc: jnovak@… added
I did a bit of digging in CVS history:

- The "Else" typo was introduced in revision 1.327 in the middle of a bunch of
other unrelated changes.

- The ALHPACOLOR_ENABLED stuff was first introduced in revision 1.191:

----------------------------
revision 1.191
date: 2003/02/15 20:21:51;  author: novak;  state: Exp;  lines: +271 -36
Initial graticule support
----------------------------

Added John to CC of this bug.

I guess I'm back with my question from November 2003: "Should something be added
to the docs and the configure script for this?"

comment:6 by sdlime, 17 years ago

I haven't had any plans (or heard a good reason) to use alpha channel values in 
colors. Rather I would support a style-level or label-level opacity value that 
would serve that function and impact all colors associated with an object. 
Doing so would mitigate configuration confusion, would not require a change to 
the colorObj (and all supporting code), and would keep configuration in the 
mapfile straight forward.

Unless other complelling reasons exist (and they might) I would just as soon 
remove all references to ALPHACOLOR_ENABLED...

Steve

comment:7 by dmorissette, 17 years ago

Resolution: fixed
Status: newclosed
I do not have much opinion on whether ALPHACOLOR_ENABLED is useful or not. Would
Simon's use case (comment #4) be addressed by a style-level opacity setting?

If we don't hear any good reason to maintain this code then I agree that it
should be removed.

I think this is becoming off-topic for this bug and should really be discussed
on mapserver-dev. I'll start a thread there.

Marking this bug FIXED since the initial issue (the compile error) has been
fixed. If other work is required then new bugs should be created.
Note: See TracTickets for help on using tickets.