[GRASS5] confused by lib fns

Hamish hamish_nospam at yahoo.com
Fri Oct 7 03:23:41 EDT 2005


while trying to fix the broken d.rast.num "-f", I am running into two
(possible) gis lib bugs in lib/gis/color_get.c.

1) G_get_raster_color() should just be G_get_color() updated to handle
   FP raster maps, ie you can specify map_type. You should be able to
   feed the fn a value and a color table and it will return R,G,B values.
   But G_get_raster_color() seems confused .. it takes a raster array?!
   This conflicts with the Doxygen comment? or at least is misleading.

   Also flows through to color_look.c's G_lookup_raster_colors() and
   G__lookup_colors(), also conflicting with Doxygen comments?

   lib/display/raster_rgb.c and ps/ps.map/ps_raster.c use it, so I won't
   say that it is completly broken, but it is confusing and I can't get 
   it to return real values for R,G,B. see number.c in CVS (&cell[col]).
   Do I need to G_alloc() a cell array first or something?

   To get `d.rast.num -f` to work currently I need to cast to CELL then 
   run G_get_color(). :/

   Note double Doxygen comments in color_get.c messes up old Prog. Manual.


2) All fn's in color_get.c have R,G,B as int, but lib/raster/RGB_color.c
   wants unsigned char. You can't access & set the display color without
   the compiler doing a cast.  gis.h likes unsigned char.
   Should color_get.c be changed to use unsigned char?



thanks,
Hamish




More information about the grass-dev mailing list