[GRASS5] Volunteer wanted for CELL driver color problem

Glynn Clements glynn.clements at virgin.net
Sun Apr 22 10:14:36 EDT 2001


Markus Neteler wrote:

> > I don't think that a 24-bit CELL driver would be that much work. The
> > cell driver doesn't actually do much. All of the actual plotting goes
> > through two functions in file_io.c; one to plot a pixel and one two
> > draw a horizontal line.
> 
> Sounds good :-) Personally the PNG driver looks more interesting as it
> needs less work to extract such a map from GRASS comparing to the CELL
> driver. But at least the color problems should be fixed even for 8bit.

I've been looking at XDRIVER/lib. I've removed a lot of the files, on
the basis that they are (effectively) identical to the ones in lib. Of
the four files which remain (Color.c, Num_colors.c, Raster_def.c,
color_supp.c), three involve colour handling.

However, I've found a couple of differences which need some
explaining:

In color_supp.c:

 int
 assign_standard_color (int user_color, int real_color)
 {
-  if (user_color > 0 && user_color < MAX_STD_COLORS)
+  if ((user_color >= 0) && (user_color < MAX_STD_COLORS))
     standard_colors[user_color] = real_color;
 
   return 0;
 }
 
 int
 get_standard_color (int user_color)
 {
-  if (user_color > 0 && user_color < MAX_STD_COLORS)
+  if ((user_color >= 0) && (user_color < MAX_STD_COLORS))
     return standard_colors[user_color];
   else
-    return 0;
+    return -1;
 }

In Num_colors.c:

 int
 Number_of_colors (int *n)
 {
   Get_num_colors (n);
 
 /* reduce the number of colors by the number of
  * vector colors, if current table type is float
  */
+  *n -= get_color_offset ();
   if (get_table_type () == FLOAT)
     *n -= get_max_std_colors ();
 
   return 0;
 }

I'm wondering whether these differences should be there, or whether
they're the result of yet another fix which was inadvertantly omitted
from one of the versions. The differences exist in the earliest CVS
revisions.

> If I try the spearfish dataset, I get stripy output only.
> 
> g.region rast=elevation.dem
> d.rast elevation.dem
> d.mon CELL
> d.rast elevation.dem
> d.mon stop=CELL
> g.region rast=D_cell
> d.mon sel=x0
> d.erase
> d.rast D_cell
> 
> -> stripes of NULL, two pixel wide, distance 106m

Are you referring to horizontal lines at the top and bottom of the
image?

> Ah: I just found that I can stop the CELL monitor several times but
> not restart (once I made a mistake in command order):
> GRASS:~ > d.mon stop=CELL
> GRASS:~ > d.mon stop=CELL
> GRASS:~ > d.mon stop=CELL
> GRASS:~ > d.mon CELL
> Graphics driver [CELL] is already running
> ERROR: Unable to start monitor <CELL>
> Problem selecting CELL. Will try once more

I don't get that. I get this:

GRASS:/usr/src/grass5-rel > d.mon start=CELL
Wait for 'READY'
READY
Graphics driver [CELL] started
GRASS:/usr/src/grass5-rel > d.mon stop=CELL
Monitor 'CELL' terminated
GRASS:/usr/src/grass5-rel > d.mon stop=CELL
Error - Monitor 'CELL' was not running
GRASS:/usr/src/grass5-rel > d.mon stop=CELL
Error - Monitor 'CELL' was not running
GRASS:/usr/src/grass5-rel > d.mon CELL
Wait for 'READY'
READY
Graphics driver [CELL] started
GRASS:/usr/src/grass5-rel > 

-- 
Glynn Clements <glynn.clements at virgin.net>

---------------------------------------- 
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo at geog.uni-hannover.de with
subject 'unsubscribe grass5'



More information about the grass-dev mailing list