[GRASS-dev] inverted color scales

Hamish hamish_nospam at yahoo.com
Tue Jul 3 03:47:17 EDT 2007


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

I've wanted this for a long time too.


Glynn:
> 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;
>     }

done in 6.3 CVS.

> 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).

I think that it matters too, and I put it before the scaling.
(flipping it is conceptually a linear operation, don't apply a linear
operation to log-transformed data; or if you prefer, keep the rule defn
code separate from the math post-processing code)


Hamish




More information about the grass-dev mailing list