[GRASS5] Raster_int()

Glynn Clements glynn.clements at virgin.net
Wed Aug 8 09:04:49 EDT 2001

GRASS wrote:

> I have a question about Raster() functions.

> in the above code segment, we can know that 'num' means the length of 'array'.
> However,

> src/display/devices/XDRIVER/XDRIVER24/Raster.c:

> in XPutPixel() calls, we always put pixels in the same row 0.
> And if some zero values found, XPutImage() duplicates this row 0 into row
> 1-(nrows-1).

> 'num' is ncols.


> 'num' is the number of array elements.


> So, we should use Raster_int() like the followings:
> 	for(i=0; i<3; i++){
> 		R_move_abs(x, y+i);
> 		R_raster(5, 1, 0, array+5*i);
> 			/* this func calls Raster_int(5, 1, array+5*i, 0, 1); */
> 	}

Yes, if you want to display the raster without scaling.

> 'nrows' should be always '1' to get a correct result.

"nrows" is the number of rows to draw with the specified raster data.

> Why is this needed?

So that you draw scaled rasters without having to repeatedly send
identical data.

> Is this intended?


> It's so inconvenient and not easy to predict results.
> All modules may be working on 'CASE C)'.

No. Raster operations are normally scaled according to the size of the
monitor window. If the monitor window is larger than the region's
resolution, then R_raster() will frequently be called with nrows > 1.

Look at raster.c and raster2.c in src/libes/display.

Glynn Clements <glynn.clements at virgin.net>

More information about the grass-dev mailing list