GRASS GIS 7 Programmer's Manual  7.5.svn(2017)-r71915
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
color_get.c File Reference

Raster Library - Get colors from a raster map. More...

#include <grass/gis.h>
#include <grass/raster.h>
Include dependency graph for color_get.c:

Go to the source code of this file.

Functions

int Rast_get_color (const void *rast, int *red, int *grn, int *blu, struct Colors *colors, RASTER_MAP_TYPE map_type)
 Gets color from raster map. More...
 
int Rast_get_c_color (const CELL *rast, int *red, int *grn, int *blu, struct Colors *colors)
 Gets color from raster map (CELL) More...
 
int Rast_get_f_color (const FCELL *rast, int *red, int *grn, int *blu, struct Colors *colors)
 Gets color from raster map (FCELL) More...
 
int Rast_get_d_color (const DCELL *rast, int *red, int *grn, int *blu, struct Colors *colors)
 Gets color from raster map (DCELL) More...
 
void Rast_get_null_value_color (int *red, int *grn, int *blu, const struct Colors *colors)
 Gets color for null value. More...
 
void Rast_get_default_color (int *red, int *grn, int *blu, const struct Colors *colors)
 Gets default color. More...
 

Detailed Description

Raster Library - Get colors from a raster map.

(C) 2001-2009 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.

Author
Original author CERL

Definition in file color_get.c.

Function Documentation

int Rast_get_c_color ( const CELL rast,
int red,
int grn,
int blu,
struct Colors colors 
)

Gets color from raster map (CELL)

Looks up the rgb colors for rast in the color table colors.

Parameters
rastraster cell value
[out]redred value
[out]grngreen value
[out]blublue value
colorspointer to Colors structure which holds color info
Returns
1 if color is set
0 if color is not set

Definition at line 68 of file color_get.c.

References CELL_TYPE, and Rast_get_color().

Referenced by Gp_load_sites_thematic(), gsd_put_legend(), and Gv_load_vect_thematic().

int Rast_get_color ( const void *  rast,
int red,
int grn,
int blu,
struct Colors colors,
RASTER_MAP_TYPE  map_type 
)

Gets color from raster map.

Looks up the rgb colors for rast in the color table colors.

The red, green, and blue intensities for the color associated with category n are extracted from the colors structure. The intensities will be in the range 0 -

  1. Also works for null cells.
Parameters
rastraster cell value
[out]redred value
[out]grngreen value
[out]blublue value
colorspointer to Colors structure which holds color info
map_typemap type (CELL, FCELL, DCELL)
Returns
1 if color is set
0 if color is not set

Definition at line 38 of file color_get.c.

References b, g, int, r, and Rast_lookup_colors().

Referenced by D_color_of_type(), Rast_get_c_color(), Rast_get_d_color(), and Rast_get_f_color().

int Rast_get_d_color ( const DCELL rast,
int red,
int grn,
int blu,
struct Colors colors 
)

Gets color from raster map (DCELL)

Looks up the rgb colors for rast in the color table colors.

Parameters
rastraster cell value
[out]redred value
[out]grngreen value
[out]blublue value
colorspointer to Colors structure which holds color info
Returns
1 if color is set
0 if color is not set

Definition at line 110 of file color_get.c.

References DCELL_TYPE, and Rast_get_color().

Referenced by gsd_put_legend(), Rast_abs_log_colors(), Rast_histogram_eq_colors(), Rast_histogram_eq_fp_colors(), and Rast_log_colors().

void Rast_get_default_color ( int red,
int grn,
int blu,
const struct Colors colors 
)

Gets default color.

Puts the red, green, and blue components of the "default" color into red, grn, and blu.

Parameters
[out]redred value
[out]grngreen value
[out]blublue value
colorspointer to Colors structure which holds color info

Definition at line 155 of file color_get.c.

References int, Colors::undef_blu, Colors::undef_grn, Colors::undef_red, and Colors::undef_set.

Referenced by Rast__lookup_colors(), Rast_abs_log_colors(), Rast_histogram_eq_colors(), Rast_histogram_eq_fp_colors(), Rast_log_colors(), and Rast_print_colors().

int Rast_get_f_color ( const FCELL rast,
int red,
int grn,
int blu,
struct Colors colors 
)

Gets color from raster map (FCELL)

Looks up the rgb colors for rast in the color table colors.

Parameters
rastraster cell value
[out]redred value
[out]grngreen value
[out]blublue value
colorspointer to Colors structure which holds color info
Returns
1 if color is set
0 if color is not set

Definition at line 89 of file color_get.c.

References FCELL_TYPE, and Rast_get_color().

Referenced by Gvl_get_color_for_value().

void Rast_get_null_value_color ( int red,
int grn,
int blu,
const struct Colors colors 
)

Gets color for null value.

Puts the red, green, and blue components of colors for the NULL-value into red, grn, and blu.

Parameters
[out]redred value
[out]grngreen value
[out]blublue value
colorspointer to Colors structure which holds color info

Definition at line 127 of file color_get.c.

References int, Colors::null_blu, Colors::null_grn, Colors::null_red, Colors::null_set, Colors::undef_blu, Colors::undef_grn, Colors::undef_red, and Colors::undef_set.

Referenced by Rast__lookup_colors(), Rast_abs_log_colors(), Rast_histogram_eq_colors(), Rast_histogram_eq_fp_colors(), Rast_log_colors(), and Rast_print_colors().