GRASS GIS 7 Programmer's Manual
7.9.dev(2021)-e5379bbd7
|
Raster Library - Read color table of raster map. More...
Go to the source code of this file.
Functions | |
int | Rast_read_colors (const char *name, const char *mapset, struct Colors *colors) |
Read color table of raster map. More... | |
int | Rast__read_colors (const char *element, const char *name, const char *mapset, struct Colors *colors) |
void | Rast_mark_colors_as_fp (struct Colors *colors) |
Mark colors as floating-point. More... | |
Raster Library - Read color table of raster map.
(C) 1999-2009, 2011 by the GRASS Development Team
This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.
Definition in file raster/color_read.c.
int Rast__read_colors | ( | const char * | element, |
const char * | name, | ||
const char * | mapset, | ||
struct Colors * | colors | ||
) |
Definition at line 116 of file raster/color_read.c.
void Rast_mark_colors_as_fp | ( | struct Colors * | colors | ) |
Mark colors as floating-point.
Sets a flag in the colors structure that indicates that these colors should only be looked up using floating-point raster data (not integer data). In particular if this flag is set, the routine Rast_get_c_colors_min_max() should return min=-255$^3$ and max=255$^3$.
colors | pointer to Colors structure |
Definition at line 394 of file raster/color_read.c.
References Colors::is_float.
int Rast_read_colors | ( | const char * | name, |
const char * | mapset, | ||
struct Colors * | colors | ||
) |
Read color table of raster map.
The color table for the raster map name in the specified mapset is read into the colors structure. If the data layer has no color table, a default color table is generated and 0 is returned. If there is an error reading the color table, a diagnostic message is printed and -1 is returned. If the color table is read ok, 1 is returned.
This routine reads the rules from the color file. If the input raster map is is a floating-point map it calls Rast_mark_colors_as_fp().
Note: If a secondary color file for map name name exists in the current project, that color file is read. This allows the user to define their own color lookup tables for cell maps found in other mapsets.
Warning message is printed if the color file is missing or invalid.
name | map name | |
mapset | mapset name | |
[out] | colors | pointer to Colors structure |
Definition at line 55 of file raster/color_read.c.
Referenced by gsd_put_legend(), and Rast_map_to_img_str().