63 const char *mapset =
NULL;
76 if(color_mode > 3 || color_mode < 1)
99 voidc = (
CELL *) cell_buf;
101 voidc = (
FCELL *) fcell_buf;
103 voidc = (
DCELL *) dcell_buf;
107 if(color_mode == 1 || color_mode == 2) {
108 for (row = 0; row < rows; row++) {
111 cols, &colors, rtype);
113 alpha = (
unsigned char)255;
116 alpha = (
unsigned char)0;
118 for (col = 0; col < cols; col++) {
121 result[i++] = blue[col];
122 result[i++] = green[col];
123 result[i++] = red[col];
136 for (row = 0; row < rows; row++) {
139 cols, &colors, rtype);
141 if(color_mode == 3) {
142 for (col = 0; col < cols; col++) {
144 result[i++] = ((red[col]) * 11 +
146 (blue[col]) * 5) >> 5;
149 for (col = 0; col < cols; col++) {
151 result[i++] = ((red[col]) * 19 +
153 (blue[col]) * 7) >> 6;
void G_free(void *)
Free allocated memory.
DCELL * Rast_allocate_d_buf(void)
Allocates memory for a raster map of type DCELL.
void Rast_free_colors(struct Colors *)
Free color structure memory.
void Rast_get_row(int, void *, int, RASTER_MAP_TYPE)
Get raster row.
int Rast_open_old(const char *, const char *)
Open an existing integer raster map (cell)
void Rast_lookup_colors(const void *, unsigned char *, unsigned char *, unsigned char *, unsigned char *, int, struct Colors *, RASTER_MAP_TYPE)
Lookup an array of colors.
FCELL * Rast_allocate_f_buf(void)
Allocates memory for a raster map of type FCELL.
int Rast_window_rows(void)
Number of rows in active window.
int Rast_read_colors(const char *, const char *, struct Colors *)
Read color table of raster map.
int Rast_window_cols(void)
Number of columns in active window.
RASTER_MAP_TYPE Rast_get_map_type(int)
Determine raster type from descriptor.
const char * G_find_raster2(const char *, const char *)
Find a raster map (look but don't touch)
int Rast_map_to_img_str(char *name, int color_mode, unsigned char *result)
CELL * Rast_allocate_c_buf(void)
Allocate memory for a CELL type raster map.
void Rast_close(int)
Close a raster map.
int Rast_is_null_value(const void *, RASTER_MAP_TYPE)
To check if a raster value is set to NULL.