GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
color_read.c File Reference
#include <grass/gis.h>
#include <grass/glocale.h>
#include <string.h>
Include dependency graph for color_read.c:

Go to the source code of this file.

Functions

int G_read_colors (const char *name, const char *mapset, struct Colors *colors)
 read map layer color table More...
 
int G_mark_colors_as_fp (struct Colors *colors)
 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 G_get_colors_min_max() should return min=-255$^3$ and max=255$^3$. More...
 

Function Documentation

int G_mark_colors_as_fp ( struct Colors *  colors)

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 G_get_colors_min_max() should return min=-255$^3$ and max=255$^3$.

Parameters
colors
Returns
int

Definition at line 396 of file color_read.c.

int G_read_colors ( const char *  name,
const char *  mapset,
struct Colors *  colors 
)

read map layer color table

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.

Parameters
name
mapset
colors
Returns
int

This routine reads the rules from the color file. If the input raster map is is a floating-point map it calls G_mark_colors_as_fp().

Returns
int

Definition at line 62 of file color_read.c.

References buf, dmax, dmin, err, G_find_cell(), G_get_fp_range_min_max(), G_get_range_min_max(), G_init_colors(), G_is_c_null_value(), G_is_d_null_value(), G_make_rainbow_colors(), G_make_rainbow_fp_colors(), G_mapset(), G_mark_colors_as_fp(), G_raster_map_is_fp(), G_read_fp_range(), G_read_range(), G_warning(), max, min, sprintf(), and xname.

Referenced by Gp_set_color(), Gs_build_256lookup(), Gs_pack_colors(), Gs_pack_colors_float(), gsd_put_legend(), and IL_resample_output_2d().