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

Hamish hamish_b at yahoo.com
Wed Jan 30 22:21:35 EST 2008


Hamish wrote:
> > Is a new D_number_to_RGB(int color, unsigned char &r,&g,&b) fn
> > needed in lib/display/tran_colr.c?
Glynn:
> Yes. E.g.:
> 
> int D_color_number_to_RGB(int color, int *r, int *g, int *b)
> {
>     const struct color_rgb *c;
> 
>     if (color <= 0)
>         return 0;
> 
>     if (color >= ncolors)
>         return 0;
> 
>     c = &colors[color];
>     r = c->r;
>     g = c->g;
>     b = c->b;
> 
>     return 1;
> }


there is a problem: for some reason ncolors's value is 0 so the fn
always returns 0.


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