[GRASS5] Re: 5.3 vs 5.7 disparity

Glynn Clements glynn.clements at virgin.net
Tue Feb 3 11:14:54 EST 2004


Hamish wrote:

> > > > > > > use of DEFAULT_FG_COLOR/DEFAULT_BG_COLOR for G5.7 compliance
> > > > > > 
> > > > > > 1. Neither XDRIVER nor d.erase use these macros. d.erase could
> > > > > > be changed easily enough,
> > > ...
> > > > > d.erase is now updated, including support for color=R:G:B.
> > > > 
> > > > Should Derase() be changing the driver's colour table?
> > > 
> > > Well, it isn't ideal, but I don't think it hurts anything. The part
> > > of the table[*] that is modified is off the end of the chart
> > > (MAXCOLORS + 1)..thus ~extending the color table more than
> > > "changing" it. If something unrelated is calling that color number,
> > > it would be a bug anyway..
> > 
> > I think that you are confusing the two colour tables.
> > 
> > The standard colour table is initialised to the colours specified in
> > color.h, and cannot be changed. R_standard_color() selects a colour
> > from the standard colour table.
> > 
> > The other colour table is also initialised to the same set of colours.

Also, I've just noticed that it is reset to match the standard colour
table by R_color_table_fixed(). Similarly, the hardware palette is
similarly reset by R_color_table_float(). These two functions are used
by d.colormode.

> > However, the entries may be changed using R_reset_color() and
> > R_reset_colors(). R_color() selects colours from this table, as do the
> > R_raster* functions.
> 
> What I am concerned with is instead of resetting the 14th of 13 colors, 
> as intended,

Actually, the standard colour table has 15 entries (0 to 14); I have
no idea why, as only entries 1 to 13 are used, and there is no way for
clients to modify entries.

> I've actually reset color 14 of say 256 or 65536,

Yep; although, that is better than resetting any of colours 1 to 13,
given the behaviour of R_color_table_{fixed,float}, and the comment in
the d.colormode manpage:

BUGS
       It  is strongly recommended that the user erase the graph­
       ics monitor screen (e.g., by running d.erase)  immediately
       after changing the mode between fixed and float.

Presumably there is a reason why, R_color_table_{fixed,float}
initialise colours 1 to 13, so we probably wouldn't want to modify any
of those on the next operation.

-- 
Glynn Clements <glynn.clements at virgin.net>




More information about the grass-dev mailing list