[GRASS-dev] lib fn to convert int color number to RGB values?

Hamish hamish_b at yahoo.com
Wed Jan 30 00:09:31 EST 2008


Hamish wrote:
> If I pass the colors as a single RGBA_Color struct, I would like to
> have a parsing lib fn to replace D_parse_color(). It would call
> G_str_to_color() then fill the RGBA_Color struct, like
> set_last_color()
> in d.graph. e.g.:
>   G_str_to_RGBA(char* str, RGBA_Color color);

already done as set_RGBA_from_str() in
  display/d.paint.labels/color.c


> but for GRASS 7 does that belong in libgis?

I suggest putting the RGBA helper functions found in d.paint.labels/
color.c into libgis (color_rgba.c), except for set_color_from_RGBA()
which is a frontend to R_RGB_color() and belongs in libraster(?).


Perhaps those fns could have more grass-consistent G_() names and
variable order, but I'm unsure of classic C conventions for those.
Normally I wouldn't care, but if these will be used commonly in GRASS 7
I'd like to spend the little extra discussion time now to get
everything clean and in its most-useful state, rather than just impose
my whim of the day and be cursed for it later.

As lib fns, the one G_fatal_error() would need to change to
G_warning().
Or is it better to be silent and rely on the module programmer to check
the fn's return code?


thanks,
Hamish



      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping



More information about the grass-dev mailing list