GRASS Programmer's Manual
6.5.svn(2014)-r66266
|
GIS Library - Color rules. More...
#include <grass/gis.h>
Go to the source code of this file.
Macros | |
#define | LIMIT(x) if (x < 0) x = 0; else if (x > 255) x = 255; |
Functions | |
int | G_add_d_raster_color_rule (const DCELL *val1, int r1, int g1, int b1, const DCELL *val2, int r2, int g2, int b2, struct Colors *colors) |
Adds the floating-point rule (DCELL version) More... | |
int | G_add_f_raster_color_rule (const FCELL *cat1, int r1, int g1, int b1, const FCELL *cat2, int r2, int g2, int b2, struct Colors *colors) |
Adds the floating-point rule (FCELL version) More... | |
int | G_add_c_raster_color_rule (const CELL *cat1, int r1, int g1, int b1, const CELL *cat2, int r2, int g2, int b2, struct Colors *colors) |
Adds the floating-point rule (CCELL version) More... | |
int | G_add_raster_color_rule (const void *val1, int r1, int g1, int b1, const void *val2, int r2, int g2, int b2, struct Colors *colors, RASTER_MAP_TYPE data_type) |
Adds the floating-point rule. More... | |
int | G_add_color_rule (CELL cat1, int r1, int g1, int b1, CELL cat2, int r2, int g2, int b2, struct Colors *colors) |
Set colors rules. More... | |
int | G_add_modular_d_raster_color_rule (const DCELL *val1, int r1, int g1, int b1, const DCELL *val2, int r2, int g2, int b2, struct Colors *colors) |
Add modular color rule (DCELL version) More... | |
int | G_add_modular_f_raster_color_rule (const FCELL *val1, int r1, int g1, int b1, const FCELL *val2, int r2, int g2, int b2, struct Colors *colors) |
Add modular color rule (FCELL version) More... | |
int | G_add_modular_c_raster_color_rule (const CELL *val1, int r1, int g1, int b1, const CELL *val2, int r2, int g2, int b2, struct Colors *colors) |
Add modular color rule (CCELL version) More... | |
int | G_add_modular_raster_color_rule (const void *val1, int r1, int g1, int b1, const void *val2, int r2, int g2, int b2, struct Colors *colors, RASTER_MAP_TYPE data_type) |
Add modular color rule. More... | |
int | G_add_modular_color_rule (CELL cat1, int r1, int g1, int b1, CELL cat2, int r2, int g2, int b2, struct Colors *colors) |
Add modular color rule. More... | |
GIS Library - Color rules.
(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.
Definition in file color_rule.c.
Definition at line 19 of file color_rule.c.
int G_add_c_raster_color_rule | ( | const CELL * | cat1, |
int | r1, | ||
int | g1, | ||
int | b1, | ||
const CELL * | cat2, | ||
int | r2, | ||
int | g2, | ||
int | b2, | ||
struct Colors * | colors | ||
) |
Adds the floating-point rule (CCELL version)
See G_add_raster_color_rule() for details.
v1 | cell value | |
r1,g1,b1 | color value | |
v2 | cell value | |
r2,g2,b2 | color value | |
[in,out] | colors | pointer to color table structure |
Definition at line 89 of file color_rule.c.
int G_add_color_rule | ( | CELL | cat1, |
int | r1, | ||
int | g1, | ||
int | b1, | ||
CELL | cat2, | ||
int | r2, | ||
int | g2, | ||
int | b2, | ||
struct Colors * | colors | ||
) |
Set colors rules.
This is the heart and soul of the new color logic. It adds a color rule to the colors structure. The colors defined by the red, green, and blue values r1,g1,b1 and r2,g2,b2 are assigned to cat1 and cat2 respectively. Colors for data values between cat1 and cat2 are not stored in the structure but are interpolated when queried by G_lookup_colors andG_get_color. The color components r1,g1,b1 and r2,g2,b2 must be in the range 0 – 255. For example, to create a linear grey scale for the range 200 – 1000:
The programmer is encouraged to review Raster_Color_Table_Format how this routine fits into the 5.x raster color logic. Note. The colors structure must have been initialized by G_init_colors. See Predefined_Color_Tables for routines to build some predefined color tables.
cat1 | cell value | |
r1,g1,b1 | color value | |
cat2 | cell value | |
r2,g2,b2 | color value | |
[in,out] | colors | pointer to color table structure |
Definition at line 165 of file color_rule.c.
Referenced by G_histogram_eq_colors(), G_make_histogram_eq_colors(), G_make_histogram_log_colors(), G_set_color(), IL_output_2d(), and IL_resample_output_2d().
int G_add_d_raster_color_rule | ( | const DCELL * | val1, |
int | r1, | ||
int | g1, | ||
int | b1, | ||
const DCELL * | val2, | ||
int | r2, | ||
int | g2, | ||
int | b2, | ||
struct Colors * | colors | ||
) |
Adds the floating-point rule (DCELL version)
See G_add_raster_color_rule() for details.
v1 | cell value | |
r1,g1,b1 | color value | |
v2 | cell value | |
r2,g2,b2 | color value | |
[in,out] | colors | pointer to color table structure |
Definition at line 41 of file color_rule.c.
Referenced by G_abs_log_colors(), G_histogram_eq_colors_fp(), G_log_colors(), G_read_color_rules(), G_set_d_color(), and IL_resample_output_2d().
int G_add_f_raster_color_rule | ( | const FCELL * | cat1, |
int | r1, | ||
int | g1, | ||
int | b1, | ||
const FCELL * | cat2, | ||
int | r2, | ||
int | g2, | ||
int | b2, | ||
struct Colors * | colors | ||
) |
Adds the floating-point rule (FCELL version)
See G_add_raster_color_rule() for details.
v1 | cell value | |
r1,g1,b1 | color value | |
v2 | cell value | |
r2,g2,b2 | color value | |
[in,out] | colors | pointer to color table structure |
Definition at line 65 of file color_rule.c.
Referenced by IL_output_2d(), and IL_resample_output_2d().
int G_add_modular_c_raster_color_rule | ( | const CELL * | val1, |
int | r1, | ||
int | g1, | ||
int | b1, | ||
const CELL * | val2, | ||
int | r2, | ||
int | g2, | ||
int | b2, | ||
struct Colors * | colors | ||
) |
Add modular color rule (CCELL version)
val1 | cell value | |
r1,g1,b1 | color value | |
val2 | cell value | |
r2,g2,b2 | color value | |
[in,out] | colors | pointer to color table structure |
Definition at line 249 of file color_rule.c.
References G_add_modular_color_rule().
int G_add_modular_color_rule | ( | CELL | cat1, |
int | r1, | ||
int | g1, | ||
int | b1, | ||
CELL | cat2, | ||
int | r2, | ||
int | g2, | ||
int | b2, | ||
struct Colors * | colors | ||
) |
Add modular color rule.
This function seems to be same as G_add_modular_raster_color_rule(). Can be removed?
val1 | cell value | |
r1,g1,b1 | color value | |
val2 | cell value | |
r2,g2,b2 | color value | |
[in,out] | colors | pointer to color table structure |
data_type | raster data type |
Definition at line 310 of file color_rule.c.
Referenced by G_add_modular_c_raster_color_rule(), and G_make_random_colors().
int G_add_modular_d_raster_color_rule | ( | const DCELL * | val1, |
int | r1, | ||
int | g1, | ||
int | b1, | ||
const DCELL * | val2, | ||
int | r2, | ||
int | g2, | ||
int | b2, | ||
struct Colors * | colors | ||
) |
Add modular color rule (DCELL version)
val1 | cell value | |
r1,g1,b1 | color value | |
val2 | cell value | |
r2,g2,b2 | color value | |
[in,out] | colors | pointer to color table structure |
Definition at line 187 of file color_rule.c.
Referenced by IL_resample_output_2d().
int G_add_modular_f_raster_color_rule | ( | const FCELL * | val1, |
int | r1, | ||
int | g1, | ||
int | b1, | ||
const FCELL * | val2, | ||
int | r2, | ||
int | g2, | ||
int | b2, | ||
struct Colors * | colors | ||
) |
Add modular color rule (FCELL version)
val1 | cell value | |
r1,g1,b1 | color value | |
val2 | cell value | |
r2,g2,b2 | color value | |
[in,out] | colors | pointer to color table structure |
Definition at line 218 of file color_rule.c.
int G_add_modular_raster_color_rule | ( | const void * | val1, |
int | r1, | ||
int | g1, | ||
int | b1, | ||
const void * | val2, | ||
int | r2, | ||
int | g2, | ||
int | b2, | ||
struct Colors * | colors, | ||
RASTER_MAP_TYPE | data_type | ||
) |
Add modular color rule.
Question: shouldn't this function call G_add_modular_<data_type>_raster_color_rule() instead???
val1 | cell value | |
r1,g1,b1 | color value | |
val2 | cell value | |
r2,g2,b2 | color value | |
[in,out] | colors | pointer to color table structure |
data_type | raster data type |
Definition at line 274 of file color_rule.c.
int G_add_raster_color_rule | ( | const void * | val1, |
int | r1, | ||
int | g1, | ||
int | b1, | ||
const void * | val2, | ||
int | r2, | ||
int | g2, | ||
int | b2, | ||
struct Colors * | colors, | ||
RASTER_MAP_TYPE | data_type | ||
) |
Adds the floating-point rule.
Adds the floating-point rule that the range [v1,v2] gets a linear ramp of colors from [r1,g1,b1] to [r2,g2,b2]. If either v1 or v2 is the NULL-value, this call is converted into G_set_null_value_color (r1, g1, b1, colors)
v1 | cell value | |
r1,g1,b1 | color value | |
v2 | cell value | |
r2,g2,b2 | color value | |
[in,out] | colors | pointer to color table structure |
data_type | raster data type (CELL, FCELL, DCELL) |
Definition at line 122 of file color_rule.c.