[GRASS5] Color code cleanup
cedricgrass at shockfamily.net
Tue Apr 18 01:48:22 EDT 2006
I've committed quite a large piece of color code cleanup. Here's a summary:
Definitions of the rgb values for preallocated ("standard") colors are now in
colors.h. The major color related code (D_translate, G_str_to_color, and the
definitions of color tables in XDRIVER and PNG) have been updated to use
this. I haven't updated the named_colr.c code because I don't have an easy
way to test it. I haven't touched the postscript code, as it is quite
gui.tcl color code is changed to match the colors in colors.h. My illconceived
tcltk color prompt type has been removed.
Color definitions have changed slightly. MAGENTA and VIOLET make more sense
now for the XDRIVER and PNG colors. GREY and GRAY are now 128 128 128, and
other midrange values are 128s. The midrange standard changes the meaning of
G_str_to_color named colors slightly.
I added a new preallocated color for cyan. This makes MAXCOLORS 14.
PURPLE and "purple" are aliases for VIOLET and "violet", which might help out
the ps.map issue Hamish pointed out.
If you are getting incorrect colors after make-ing or if "brown" fails to be a
color the easiest way to correct this will be with a make clean and a make.
touch-ing or modifying colors.h doesn't cause XDRIVER, PNG, or lib/display
to be recompiled.
These are somewhat independent changes:
It is possible to extend named colors modifying just G_str_to_color, though I
am uncertain of the wisdom of doing so. It is ill-advised at least until the
color display modules consistently use G_str_to_color to parse colors.
I added some more D_ commands to make working with colors easier and eliminate
the need for including colors.h and working with MAXCOLORS in display
modules. I've updated a couple modules to use this simplified code. These
modules also now have gisprompts for color.
I hope to get through almost all of the display modules, simplifying code,
adding custom color support to those that don't already have it, and adding
gisprompts. d.colortable isn't going to get custom border colors.
More information about the grass-dev