GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-36359e2344
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

◆ Rast_get_c_color()

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 67 of file color_get.c.

◆ Rast_get_color()

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.

◆ Rast_get_d_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 109 of file color_get.c.

Referenced by Rast_abs_log_colors(), and Rast_log_colors().

◆ Rast_get_default_color()

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 154 of file color_get.c.

Referenced by Rast_abs_log_colors(), and Rast_log_colors().

◆ Rast_get_f_color()

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 88 of file color_get.c.

Referenced by Gvl_get_color_for_value().

◆ Rast_get_null_value_color()

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 126 of file color_get.c.

Referenced by Rast_abs_log_colors(), and Rast_log_colors().