GRASS GIS 7 Programmer's Manual  7.5.svn(2017)-r71942
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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)   if (x < 0) x = 0; else if (x > 255) x = 255;
 

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

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

Definition at line 17 of file color_rule.c.

Function Documentation

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 75 of file color_rule.c.

References CELL_TYPE, Colors::cmax, Colors::cmin, Colors::fixed, and Colors::version.

Referenced by IL_output_2d(), IL_resample_output_2d(), Rast_histogram_eq_colors(), Rast_make_histogram_eq_colors(), Rast_make_histogram_log_colors(), and Rast_set_c_color().

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.

References Colors::cmax, Colors::cmin, Colors::fixed, and Colors::version.

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 35 of file color_rule.c.

References Colors::cmax, Colors::cmin, DCELL_TYPE, Colors::fixed, and Colors::version.

Referenced by IL_resample_output_2d(), Rast_abs_log_colors(), Rast_histogram_eq_fp_colors(), Rast_log_colors(), Rast_read_color_rules(), and Rast_set_d_color().

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 55 of file color_rule.c.

References Colors::cmax, Colors::cmin, FCELL_TYPE, Colors::fixed, and Colors::version.

Referenced by IL_output_2d(), and IL_resample_output_2d().

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.

References CELL_TYPE, Colors::cmax, Colors::cmin, max, min, Colors::modular, and Colors::version.

Referenced by Rast_make_random_colors().

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.

References Colors::cmax, Colors::cmin, max, min, Colors::modular, and Colors::version.

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.

References Colors::cmax, Colors::cmin, DCELL_TYPE, max, min, Colors::modular, and Colors::version.

Referenced by IL_resample_output_2d().

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.

References Colors::cmax, Colors::cmin, FCELL_TYPE, max, min, Colors::modular, and Colors::version.