GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
color_get.c File Reference

GIS Library - Functions to get colors from a raster map. More...

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

Go to the source code of this file.

Functions

int G_get_color (CELL n, int *red, int *grn, int *blu, struct Colors *colors)
 Get a category color. More...
 
int G_get_raster_color (const void *rast, int *red, int *grn, int *blu, struct Colors *colors, RASTER_MAP_TYPE map_type)
 Gets color from raster. More...
 
int G_get_c_raster_color (const CELL *rast, int *red, int *grn, int *blu, struct Colors *colors)
 Gets color for a CELL raster. More...
 
int G_get_f_raster_color (const FCELL *rast, int *red, int *grn, int *blu, struct Colors *colors)
 Gets color for a FCELL raster. More...
 
int G_get_d_raster_color (const DCELL *rast, int *red, int *grn, int *blu, struct Colors *colors)
 Gets color for a DCELL raster. More...
 
int G_get_null_value_color (int *red, int *grn, int *blu, const struct Colors *colors)
 Gets color for null value. More...
 
int G_get_default_color (int *red, int *grn, int *blu, const struct Colors *colors)
 Gets default color. More...
 

Detailed Description

GIS Library - Functions to get colors from a raster map.

(C) 2001-2008 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
GRASS GIS Development Team
Date
1999-2008

Definition in file color_get.c.

Function Documentation

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

Gets color for a CELL raster.

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

Parameters
[in]rastinput CELL raster
[out]redred value
[out]grngreen value
[out]blublue value
[in]colorsColors struct
Returns
int

Definition at line 97 of file color_get.c.

References G_get_raster_color().

int G_get_color ( CELL  n,
int red,
int grn,
int blu,
struct Colors *  colors 
)

Get a category color.

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 ­- 255. Also works for null cells.

Parameters
[in]nCELL to get color from
[out]redred value
[out]grngreen value
[out]blublue value
[in]colorsColors struct
Returns
int

Definition at line 36 of file color_get.c.

References b, cat, g, G_lookup_colors(), int, n, r, and main::set.

Referenced by Gp_set_color(), and gsd_put_legend().

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

Gets color for a DCELL raster.

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

Parameters
[in]rastinput DCELL raster
[out]redred value
[out]grngreen value
[out]blublue value
[in]colorsColors struct
Returns
int

Definition at line 139 of file color_get.c.

References G_get_raster_color().

Referenced by G_abs_log_colors(), G_histogram_eq_colors(), G_histogram_eq_colors_fp(), G_log_colors(), and gsd_put_legend().

int G_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
[in]colorsColors struct
Returns
always returns 0

Definition at line 192 of file color_get.c.

References int.

Referenced by G__lookup_colors(), G_abs_log_colors(), G_histogram_eq_colors(), G_histogram_eq_colors_fp(), and G_log_colors().

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

Gets color for a FCELL raster.

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

Parameters
[in]rastinput FCELL raster
[out]redred value
[out]grngreen value
[out]blublue value
[in]colorsColors struct
Returns
int

Definition at line 118 of file color_get.c.

References G_get_raster_color().

Referenced by Gvl_get_color_for_value().

int G_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
[in]colorsColors struct
Returns
always returns 0

Definition at line 159 of file color_get.c.

References int.

Referenced by G__lookup_colors(), G_abs_log_colors(), G_histogram_eq_colors(), G_histogram_eq_colors_fp(), and G_log_colors().

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

Gets color from raster.

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

Parameters
[in]rastinput raster map
[out]redred value
[out]grngreen value
[out]blublue value
[in]colorsColors struct
[in]map_typetype of map (CELL_TYPE,FCELL_TYPE,DCELL_TYPE)
Returns
int

Definition at line 67 of file color_get.c.

References b, g, G_lookup_raster_colors(), int, r, and main::set.

Referenced by D_color_of_type(), G_get_c_raster_color(), G_get_d_raster_color(), and G_get_f_raster_color().