GRASS GIS 7 Programmer's Manual  7.9.dev(2021)-e5379bbd7
color_look.c File Reference

Raster Library - Lookup array of colors. More...

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

Go to the source code of this file.

Functions

void Rast_lookup_c_colors (const CELL *cell, unsigned char *red, unsigned char *grn, unsigned char *blu, unsigned char *set, int n, struct Colors *colors)
 Lookup an array of colors. More...
 
void Rast_lookup_colors (const void *raster, unsigned char *red, unsigned char *grn, unsigned char *blu, unsigned char *set, int n, struct Colors *colors, RASTER_MAP_TYPE map_type)
 Lookup an array of colors. More...
 
void Rast_lookup_f_colors (const FCELL *fcell, unsigned char *red, unsigned char *grn, unsigned char *blu, unsigned char *set, int n, struct Colors *colors)
 Lookup an array of colors (FCELL) More...
 
void Rast_lookup_d_colors (const DCELL *dcell, unsigned char *red, unsigned char *grn, unsigned char *blu, unsigned char *set, int n, struct Colors *colors)
 Lookup an array of colors (DCELL) More...
 
void Rast__lookup_colors (const void *raster, unsigned char *red, unsigned char *grn, unsigned char *blu, unsigned char *set, int n, struct Colors *colors, int mod, int rules_only, RASTER_MAP_TYPE data_type)
 Lookup an array of colors. More...
 
void Rast__interpolate_color_rule (DCELL val, unsigned char *red, unsigned char *grn, unsigned char *blu, const struct _Color_Rule_ *rule)
 Interpolate color rules. More...
 

Detailed Description

Raster Library - Lookup array of colors.

(C) 1999-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
USACERL and many others

Definition in file color_look.c.

Function Documentation

◆ Rast__interpolate_color_rule()

void Rast__interpolate_color_rule ( DCELL  val,
unsigned char *  red,
unsigned char *  grn,
unsigned char *  blu,
const struct _Color_Rule_ rule 
)

Interpolate color rules.

Parameters
valraster cell value
[out]redred value
[out]grngreen value
[out]blublue value
rulepointer to _Color_Rule which holds color rules info

Definition at line 417 of file color_look.c.

References _Color_Value_::blu, _Color_Value_::grn, _Color_Rule_::high, _Color_Value_::red, and _Color_Value_::value.

◆ Rast__lookup_colors()

void Rast__lookup_colors ( const void *  raster,
unsigned char *  red,
unsigned char *  grn,
unsigned char *  blu,
unsigned char *  set,
int  n,
struct Colors colors,
int  mod,
int  rules_only,
RASTER_MAP_TYPE  data_type 
)

Lookup an array of colors.

Parameters
rasterraster cell value
[out]redred value
[out]grngreen value
[out]blublue value
setarray which indicates if color is set or not
nnumber of values
colorspointer to Colors structure which holds color info
mod
rules_only
data_typeraster type (CELL, FCELL, DCELL)

Definition at line 195 of file color_look.c.

◆ Rast_lookup_c_colors()

void Rast_lookup_c_colors ( const CELL cell,
unsigned char *  red,
unsigned char *  grn,
unsigned char *  blu,
unsigned char *  set,
int  n,
struct Colors colors 
)

Lookup an array of colors.

Extracts colors for an array of cell values. The colors for the n values in the cell array are stored in the red, green, and blue arrays. The values in the set array will indicate if the corresponding cell value has a color or not (1 means it does, 0 means it does not).

The programmer must allocate the red, green, blue, and set arrays to be at least dimension n.

Note: The red, green, and blue intensities will be in the range 0 - 255.

Modified to return a color for NULL-values.

Parameters
cellraster cell value
[out]redred value
[out]grngreen value
[out]blublue value
setarray which indicates if color is set or not
nnumber of values
colorspointer to Colors structure which holds color info

Definition at line 45 of file color_look.c.

◆ Rast_lookup_colors()

void Rast_lookup_colors ( const void *  raster,
unsigned char *  red,
unsigned char *  grn,
unsigned char *  blu,
unsigned char *  set,
int  n,
struct Colors colors,
RASTER_MAP_TYPE  map_type 
)

Lookup an array of colors.

Parameters
rasterraster cell value
[out]redred value
[out]grngreen value
[out]blublue value
setarray which indicates if color is set or not
nnumber of values
colorspointer to Colors structure which holds color info
map_typeraster type (CELL, FCELL, DCELL)

Definition at line 79 of file color_look.c.

Referenced by Rast_map_to_img_str().

◆ Rast_lookup_d_colors()

void Rast_lookup_d_colors ( const DCELL dcell,
unsigned char *  red,
unsigned char *  grn,
unsigned char *  blu,
unsigned char *  set,
int  n,
struct Colors colors 
)

Lookup an array of colors (DCELL)

Converts the n double-precision values in the dcell array to their r,g,b color components. Embedded NULL-values are handled properly as well.

Parameters
dcellraster cell value
[out]redred value
[out]grngreen value
[out]blublue value
setarray which indicates if color is set or not
nnumber of values
colorspointer to Colors structure which holds color info

Definition at line 146 of file color_look.c.

◆ Rast_lookup_f_colors()

void Rast_lookup_f_colors ( const FCELL fcell,
unsigned char *  red,
unsigned char *  grn,
unsigned char *  blu,
unsigned char *  set,
int  n,
struct Colors colors 
)

Lookup an array of colors (FCELL)

Converts the n floating-point values in the fcell array to their r,g,b color components. Embedded NULL-values are handled properly as well.

Parameters
fcellraster cell value
[out]redred value
[out]grngreen value
[out]blublue value
setarray which indicates if color is set or not
nnumber of values
colorspointer to Colors structure which holds color info

Definition at line 113 of file color_look.c.