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

Glynn Clements glynn at gclements.plus.com
Fri Feb 1 07:09:26 EST 2008


Ivan Shmakov wrote:

>  > RGBA_Color was recently added (as was RGB support for modules' CLI
>  > options) so 1) it could be used to pass RGB arround without having to
>  > call the display library and 2) we could handle a color value of
>  > 'none' without needing to pass a separate variable or rely on the
>  > palette index number set to -1. Currently the alpha channel is just
>  > set to 0 or 255 for full-transparency ('none') or full-opacity.
> 
> 	Could the attached (untested) patch be of any help?

First, you would need:

	-typedef struct
	+typedef struct RGBA_Color
	 {
	     unsigned char r, g, b, a;  /* red, green, blue, and alpha */
	 } RGBA_Color ;

Normally, we use structure tags rather than typedefs. The RGBA_Color
structure and the STD_OPT enum are the only exceptions I see in gis.h.

But, replacing color_rgb with RGBA_Color should be straightforward.

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


More information about the grass-dev mailing list