[GRASS-dev] r.what.color questions

Glynn Clements glynn at gclements.plus.com
Wed May 9 08:22:33 EDT 2007


Hamish wrote:

> WRT the r.what.color module.
> 
> #### it should use map= and not input=

Okay.

> #### can it protect against malformed format strings like:
>  format="%s%s%s"
>  format="%d:%d:%d|%s"
> Segmentation fault   (and/or memory exposure)
> ?

Only by changing format= to use a list of built-in formats; analysing
a format string isn't practical.

Which formats are desired?

AFAICT, the main options are:

1. Decimal 0-255, hex 00-ff (upper-case?), float 0.0-1.0 (but how many
decimal places?).

2. Separator: none, comma, colon (others?)

3. R/G/B vs B/G/R.

> #### any call for a -s flag to scale color values from 0.0-1.0?
> [PostScript, Matlab] (-1 and -o are both bad chars for flags)

That can be incorporated into the previous format= change. Otherwise,
the format string will need to use %f instead of %u/%x.

> #### can it format output like:
> cat|<fmt>
>   instead of
> cat: <fmt>
> 
> ? (too many ":")
> 
> 1000: 0:255:0
>  vs
> 1000|0:255:0

I can add a separator= option.

> #### any comment WRT wish #382 ?
>   http://wald.intevation.org/tracker/index.php?func=detail&aid=382
> 
> it would be nice (eg for vector maps) to have something like r.colors
> color=,rules= where you could pass r.what.color a FP value= and some
> color rules and have it output value|RRR:GGG:BBB for insertion into
> a vector's table with Markus's proposed v.colors script. (for use with
> modules that use GRASS_RGB column to get color)

That's do-able.

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




More information about the grass-dev mailing list