GRASS GIS 8 Programmer's Manual  8.4.0dev(2024)-535c39c9fc
color_rule.c File Reference

Raster Library - Color rules. More...

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

Go to the source code of this file.

Macros

#define LIMIT(x)
 

Functions

void Rast_add_d_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 color rule (DCELL version) More...
 
void Rast_add_f_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 color rule (FCELL version) More...
 
void Rast_add_c_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 integer color rule (CELL version) More...
 
void Rast_add_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 color rule. More...
 
int Rast_add_modular_d_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 floating-point color rule (DCELL version) More...
 
int Rast_add_modular_f_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 floating-point color rule (FCELL version) More...
 
int Rast_add_modular_c_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 integer color rule (CELL version) More...
 
int Rast_add_modular_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...
 

Detailed Description

Raster Library - Color rules.

(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_rule.c.

Macro Definition Documentation

◆ LIMIT

#define LIMIT (   x)
Value:
if (x < 0) \
x = 0; \
else if (x > 255) \
x = 255;
#define x

Definition at line 17 of file color_rule.c.

Function Documentation

◆ Rast_add_c_color_rule()

void Rast_add_c_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 integer color rule (CELL version)

See Rast_add_color_rule() for details.

Parameters
cat1cell value
r1,g1,b1color value
cat2cell value
r2,g2,b2color value
[in,out]colorspointer to color table structure

Definition at line 76 of file color_rule.c.

◆ Rast_add_color_rule()

void Rast_add_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 color 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 ino Rast_set_null_value_color (r1, g1, b1, colors)

Parameters
val1cell value
r1,g1,b1color value
val2cell value
r2,g2,b2color value
[in,out]colorspointer to color table structure
data_typeraster data type (CELL, FCELL, DCELL)

Definition at line 104 of file color_rule.c.

◆ Rast_add_d_color_rule()

void Rast_add_d_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 color rule (DCELL version)

See Rast_add_color_rule() for details.

Parameters
val1cell value
r1,g1,b1color value
val2cell value
r2,g2,b2color value
[in,out]colorspointer to color table structure

Definition at line 38 of file color_rule.c.

◆ Rast_add_f_color_rule()

void Rast_add_f_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 color rule (FCELL version)

See Rast_add_color_rule() for details.

Parameters
cat1cell value
r1,g1,b1color value
cat2cell value
r2,g2,b2color value
[in,out]colorspointer to color table structure

Definition at line 57 of file color_rule.c.

◆ Rast_add_modular_c_color_rule()

int Rast_add_modular_c_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 integer color rule (CELL version)

Parameters
val1cell value
r1,g1,b1color value
val2cell value
r2,g2,b2color value
[in,out]colorspointer to color table structure
Returns
-1 on failure
1 on success

Definition at line 184 of file color_rule.c.

◆ Rast_add_modular_color_rule()

int Rast_add_modular_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.

Todo:
Question: shouldn't this function call G_add_modular_<data_type>_raster_color_rule() instead?
Parameters
val1cell value
r1,g1,b1color value
val2cell value
r2,g2,b2color value
[in,out]colorspointer to color table structure
data_typeraster data type
Returns
-1 on failure
1 on success

Definition at line 218 of file color_rule.c.

◆ Rast_add_modular_d_color_rule()

int Rast_add_modular_d_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 floating-point color rule (DCELL version)

Parameters
val1cell value
r1,g1,b1color value
val2cell value
r2,g2,b2color value
[in,out]colorspointer to color table structure
Returns
-1 on failure
1 on success

Definition at line 124 of file color_rule.c.

◆ Rast_add_modular_f_color_rule()

int Rast_add_modular_f_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 floating-point color rule (FCELL version)

Parameters
val1cell value
r1,g1,b1color value
val2cell value
r2,g2,b2color value
[in,out]colorspointer to color table structure
Returns
-1 on failure
1 on success

Definition at line 154 of file color_rule.c.