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

Michael Barton michael.barton at asu.edu
Mon Jan 28 10:39:12 EST 2008




On Jan 28, 2008, at 8:32 AM, grass-dev-request at lists.osgeo.org wrote:

> Date: Mon, 28 Jan 2008 04:30:21 -0800 (PST)
> From: Hamish <hamish_b at yahoo.com>
> Subject: [GRASS-dev] lib fn to convert int color number to RGB values?
> To: grass-dev at lists.osgeo.org
> Message-ID: <16992.67894.qm at web45802.mail.sp1.yahoo.com>
> Content-Type: text/plain; charset=iso-8859-1
>
> Hi,
>
> I am looking for a library function to get the R,G,B values (0-255)  
> for
> an integer color number which was created with D_parse_color(). I  
> don't
> want to set the color for drawing, just get the RGB component  
> values so
> I can populate a RGBA_Color struct. Reparsing the original color  
> string
> isn't an option without a lot of re-fn prototyping as I'm operating in
> a subordinate function with only the int color number available.
>
> I've searched through the color functions in the display, raster, and
> gis libraries without much luck. The closest I found was
> D_raster_use_color().
>
> any ideas?
>
> Is a new D_number_to_RGB(int color, unsigned char &r,&g,&b) fn needed
> in lib/display/tran_colr.c? Or some place better?
>
>
> thanks,
> Hamish

We have such functions in both the TclTk and wxPython GUI's if that  
is any help.

Michael



More information about the grass-dev mailing list