[GRASS-dev] inverted color scales

Glynn Clements glynn at gclements.plus.com
Thu Jun 28 06:44:51 EDT 2007


Maciej Sieczka wrote:

> > What do you guys think of a flag in r.colors to apply an _inverted_ color
> > scale?
> 
> Sounds really usefull to me.

Sounds really trivial to implement, too.

"struct Colors" already has an "invert" field, which can be inverted
with G_invert_colors().

AFAICT, you just need e.g.:

    flag.n = G_define_flag();
    flag.n->key = 'n';  
    flag.n->description = _("Invert colors");

	...

    if (flag.n->answer)
    {
	G_invert_colors(&colors);
	colors = colors_tmp;
    }

The only issue is whether the inversion should come before or after
logarithmic scaling (I think that it matters, although I haven't
actually checked).

As more transforms are added, it's looking more important to replace
the various flags with an option, e.g. trans=log,eq,inv.

NOTE: this will add another situation where the GUI's assumption that
opt->multiple=YES implies a set (rather than a list) will fail.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list