[GRASS5] Suggested color function names

Glynn Clements glynn at gclements.plus.com
Mon Apr 24 12:10:20 EDT 2006


Hamish wrote:

> > BTW, I suggest removing the "set" field from the structure. Without
> > that field, the structure fits into 32 bits, and I suspect that most
> > functions would ignore that field anyhow.
> > 
> > In specific cases where you actually need a "set" field, you can use
> > a separate type, e.g.:
> > 
> > struct XRGBA_Color
> > {
> > 	int set;
> > 	RGBA_Color color;
> > }
> 
> I could live without set,unset, but how to do you pass a color of "none"
> with just,
> 
> typedef struct
> {
>     unsigned char r, g, b, a;   /* red, green, blue, and alpha */
> } RGBA_Color ;
> 
> ????

In what context does a colour of "none" make sense?

If you have a particular situation where you need additional
information other than just a colour, then create your own type for
that purpose.

There's no reason why everything which deals with colours needs to
carry that field around because something which uses colours needs it.

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




More information about the grass-dev mailing list