8
* Reads a row of raster data and converts it to red,
9
* green and blue components according to the <em>colors</em> parameter.
10
* This provides a convenient way to treat a raster layer as a color
11
* image without having to explicitly cater for each of <tt>CELL</tt>, <tt>FCELL</tt> and <tt>DCELL</tt> types
24
G_get_raster_row_colors(int fd, int row, struct Colors *colors,
25
unsigned char *red, unsigned char *grn,
26
unsigned char *blu, unsigned char *nul)
29
static int array_size;
30
static unsigned char *set;
33
int cols = G__.window.cols;
34
int type = G__.fileinfo[fd].map_type;
35
int size = G_raster_size(type);
39
if (array_size < cols * size) {
40
array_size = cols * size;
41
array = (DCELL *) G_realloc(array, array_size);
44
if (set_size < cols) {
46
set = G_realloc(set, set_size);
49
if (G_get_raster_row(fd, array, row, type) < 0)
53
for (i = 0, p = array; i < cols; i++, p = G_incr_void_ptr(p, size))
54
nul[i] = G_is_null_value(p, type);
56
G_lookup_raster_colors(array, red, grn, blu, set, cols, colors, type);