GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Go to the documentation of this file.
1 #include <grass/gis.h>
2 #include "G.h"
23 int
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)
27 {
28  static void *array;
29  static int array_size;
30  static unsigned char *set;
31  static int set_size;
33  int cols = G__.window.cols;
34  int type = G__.fileinfo[fd].map_type;
35  int size = G_raster_size(type);
36  void *p;
37  int i;
39  if (array_size < cols * size) {
40  array_size = cols * size;
41  array = (DCELL *) G_realloc(array, array_size);
42  }
44  if (set_size < cols) {
45  set_size = cols;
46  set = G_realloc(set, set_size);
47  }
49  if (G_get_raster_row(fd, array, row, type) < 0)
50  return -1;
52  if (nul)
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);
58  return 0;
59 }
int G_lookup_raster_colors(const void *raster, unsigned char *red, unsigned char *grn, unsigned char *blu, unsigned char *set, int n, struct Colors *colors, RASTER_MAP_TYPE map_type)
If the cell_type is CELL_TYPE, calls G_lookup_colors((CELL *)cell, r, g, b, set, n, colors); If the cell_type is FCELL_TYPE, calls G_lookup_f_raster_colors(FCELL *)cell, r, g, b, set, n, colors); If the cell_type is DCELL_TYPE, calls G_lookup_d_raster_colors(DCELL *)cell, r, g, b, set, n, colors);.
Definition: color_look.c:118
Definition: G.h:59
FILE * fd
Definition: g3dcolor.c:368
int G_get_raster_row(int fd, void *buf, int row, RASTER_MAP_TYPE data_type)
Get raster row.
Definition: gis/get_row.c:895
int G_get_raster_row_colors(int fd, int row, struct Colors *colors, unsigned char *red, unsigned char *grn, unsigned char *blu, unsigned char *nul)
Reads a row of raster data and converts it to red, green and blue components according to the colors ...
Definition: get_row_colr.c:24
void * G_incr_void_ptr(const void *ptr, const size_t size)
Advance void pointer.
Definition: gis/raster.c:33
tuple size
value.Bind(wx.EVT_TEXT, self.OnVolumeIsosurfMap)
struct Cell_head window
Definition: G.h:78
Definition: G.h:74
size_t G_raster_size(RASTER_MAP_TYPE data_type)
Returns size of a raster CELL in bytes.
Definition: alloc_cell.c:38
struct fileinfo * fileinfo
Definition: G.h:95
tuple cols
string set
int G_is_null_value(const void *rast, RASTER_MAP_TYPE data_type)
If the data_type is CELL_TYPE, calls G_is_c_null_value ((CELL *) rast); If the data_type is FCELL_TYP...
Definition: null_val.c:207