[GRASS-dev] lib fn to convert int color number to RGB values?
Hamish
hamish_b at yahoo.com
Wed Jan 30 17:29:17 EST 2008
Ivan:
> >> BTW, is it a GRASS convention to use 0 to indicate failure?
> >> Standard C library functions tend to use -1 for failure, while
> >> using non-negative values to indicate success.
Glynn:
> > The GRASS convention is to use a different convention for each
> > function ;)
>
> > More seriously: functions which only return a success/failure
> > indication typically (but not always) return 1 for success and 0
> > for failure, so that conditionals read naturally, i.e. "if
> > (foo(...))" means "if it succeeds" and "if (!foo(...))" means
> > "if it fails".
.... and it's nice to call these functions like G_is_valid_mapname()
Ivan:
> ACK, thanks.
OT: everytime I see ACK I get this picture of Bill The Cat in my head
and chuckle
Glynn:
> > The problem is that we have both color_rgb (colors.h) and
> > RGBA_Color (gis.h) structures, and we should deprecate one of
> > them (probably color_rgb).
Ivan:
> Although I know no details, having two similar facilities
> usually implies having the code base doubled, with only a slight
> increase of functionality.
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.
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