I've committed a significant clean-up to the display architecture
(libraries and drivers).
The main change is that the drivers no longer maintain a palette; all
colours are specified directly as R/G/B values.
The following application-level functions have been removed:
R_Color
R_Raster
R_Raster_char
R_Raster_int
R_Reset_color
R_Reset_colors
Any code which used them has been re-written to use alternatives,
essentially:
old new
R_Color R_RGB_color
R_Raster R_RGB_raster
R_Raster_char R_RGB_raster
R_Raster_int R_RGB_raster
R_Reset_color n/a
R_Reset_colors n/a
Apart from removing a significant amount of (essentially unnecessary)
code, it simplifies the programming interface. Rather than having to
allocate palette entries, store the R/G/B values in the palette, then
specify colours as palette indices, the R/G/B values are specified
directly.
An added bonus is that any rasters drawn using the display library
(D_draw_cell, D_draw_raster etc) will use the display's full colour
depth (previously, they were truncated to 15 bpp / 32768 colours to
limit the amount of palette data which was uploaded).
The only "loss" is that there's no chance of R_color_table_float() or
d.colormode being resurrected. Given that 6.x has never included
d.colormode, and nobody seemed to notice, it seems safe to assume that
the days of 256-colour displays are essentially over (I haven't run a
256-colour desktop since I upgraded my 386 to a 486 sometime around
1995). 256-colour displays still work, you're just limited to the
default 6x6x6 colour-cube palette, rather than being able to choose a
custom palette.
The complete list of modules which required changes is:
display/d.extract
display/d.mapgraph
display/d.path
display/d.text.freetype
display/d.text.new
display/d.text
display/d.vect
display/d.what.vect
imagery/i.vpoints
vector/v.digit
It's probably worth giving these a brief check to ensure that colours
are still handled correctly (e.g. color=0:100:0 should give dark
green, etc).
A (marginally) related change is that the standard_colors_rgb and
standard_color_names arrays are no longer exported (there was a
problem with using array variables exported from shared libraries on
some platforms), and the MAX_COLOR_NUM and MAXCOLOR macros no longer
exist. Instead, the following functions are provided by libgis
(declared in <grass/colors.h>):
extern int G_num_standard_colors(void);
extern struct color_rgb G_standard_color_rgb(int n);
extern int G_num_standard_color_names(void);
extern const struct color_name *G_standard_color_name(int n);
R_standard_color() remains, as do D_parse_color() and
D_raster_use_color(), although the last two now use an internal
palette (they can't use the driver's palette, as it doesn't have one).
--
Glynn Clements <glynn@gclements.plus.com>