color_rule.c File Reference

#include <grass/gis.h>

Include dependency graph for color_rule.c:

Go to the source code of this file.

Defines

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

Functions

int G_add_d_raster_color_rule (DCELL *val1, int r1, int g1, int b1, DCELL *val2, int r2, int g2, int b2, struct Colors *colors)
 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).
int G_add_f_raster_color_rule (FCELL *cat1, int r1, int g1, int b1, FCELL *cat2, int r2, int g2, int b2, struct Colors *colors)
 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).
int G_add_c_raster_color_rule (CELL *cat1, int r1, int g1, int b1, CELL *cat2, int r2, int g2, int b2, struct Colors *colors)
 Calls G_add_color_rule(*v1, r1, g1, b1, *v2, r2, g2, b2, colors).
int G_add_raster_color_rule (void *val1, int r1, int g1, int b1, void *val2, int r2, int g2, int b2, struct Colors *colors, RASTER_MAP_TYPE data_type)
 If map_type is CELL_TYPE, calls G_add_c_raster_color_rule ((CELL *) v1, r1, g1, b1, (CELL *) v2, r2, g2, b2, colors); If map_type is FCELL_TYPE, calls G_add_f_raster_color_rule ((FCELL *) v1, r1, g1, b1, (FCELL *) v2, r2, g2, b2, colors); If map_type is DCELL_TYPE, calls G_add_d_raster_color_rule ((DCELL *) v1, r1, g1, b1, (DCELL *) v2, r2, g2, b2, colors);.
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
int G_add_modular_d_raster_color_rule (DCELL *val1, int r1, int g1, int b1, DCELL *val2, int r2, int g2, int b2, struct Colors *colors)
int G_add_modular_f_raster_color_rule (FCELL *val1, int r1, int g1, int b1, FCELL *val2, int r2, int g2, int b2, struct Colors *colors)
int G_add_modular_c_raster_color_rule (CELL *val1, int r1, int g1, int b1, CELL *val2, int r2, int g2, int b2, struct Colors *colors)
int G_add_modular_raster_color_rule (void *val1, int r1, int g1, int b1, void *val2, int r2, int g2, int b2, struct Colors *colors, RASTER_MAP_TYPE data_type)
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)


Define Documentation

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

Definition at line 3 of file color_rule.c.


Function Documentation

int G_add_c_raster_color_rule ( CELL *  cat1,
int  r1,
int  g1,
int  b1,
CELL *  cat2,
int  r2,
int  g2,
int  b2,
struct Colors *  colors 
)

Calls G_add_color_rule(*v1, r1, g1, b1, *v2, r2, g2, b2, colors).

Parameters:
v1 
r1 
g1 
b1 
v2 
r2 
g2 
b2 
colors 
Returns:
int

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

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:

  struct Colors colr;
  G_init_colors (&colr);
  G_add_color_rule ((CELL)200, 0,0,0, (CELL)1000, 255,255,255);
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.

Parameters:
cat1 
r1 
g1 
b1 
cat2 
r2 
g2 
b2 
colors 
Returns:
int

Definition at line 166 of file color_rule.c.

Referenced by G_make_histogram_eq_colors(), G_make_histogram_log_colors(), and G_set_color().

int G_add_d_raster_color_rule ( DCELL *  val1,
int  r1,
int  g1,
int  b1,
DCELL *  val2,
int  r2,
int  g2,
int  b2,
struct Colors *  colors 
)

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).

Parameters:
v1 
r1 
g1 
b1 
v2 
r2 
g2 
b2 
colors 
Returns:
int

Definition at line 33 of file color_rule.c.

Referenced by G_set_d_color().

int G_add_f_raster_color_rule ( FCELL *  cat1,
int  r1,
int  g1,
int  b1,
FCELL *  cat2,
int  r2,
int  g2,
int  b2,
struct Colors *  colors 
)

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).

Parameters:
v1 
r1 
g1 
b1 
v2 
r2 
g2 
b2 
colors 
Returns:
int

Definition at line 63 of file color_rule.c.

int G_add_modular_c_raster_color_rule ( CELL *  val1,
int  r1,
int  g1,
int  b1,
CELL *  val2,
int  r2,
int  g2,
int  b2,
struct Colors *  colors 
)

Definition at line 206 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 
)

Definition at line 228 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 ( DCELL *  val1,
int  r1,
int  g1,
int  b1,
DCELL *  val2,
int  r2,
int  g2,
int  b2,
struct Colors *  colors 
)

Definition at line 174 of file color_rule.c.

int G_add_modular_f_raster_color_rule ( FCELL *  val1,
int  r1,
int  g1,
int  b1,
FCELL *  val2,
int  r2,
int  g2,
int  b2,
struct Colors *  colors 
)

Definition at line 190 of file color_rule.c.

int G_add_modular_raster_color_rule ( void *  val1,
int  r1,
int  g1,
int  b1,
void *  val2,
int  r2,
int  g2,
int  b2,
struct Colors *  colors,
RASTER_MAP_TYPE  data_type 
)

Definition at line 212 of file color_rule.c.

int G_add_raster_color_rule ( void *  val1,
int  r1,
int  g1,
int  b1,
void *  val2,
int  r2,
int  g2,
int  b2,
struct Colors *  colors,
RASTER_MAP_TYPE  data_type 
)

If map_type is CELL_TYPE, calls G_add_c_raster_color_rule ((CELL *) v1, r1, g1, b1, (CELL *) v2, r2, g2, b2, colors); If map_type is FCELL_TYPE, calls G_add_f_raster_color_rule ((FCELL *) v1, r1, g1, b1, (FCELL *) v2, r2, g2, b2, colors); If map_type is DCELL_TYPE, calls G_add_d_raster_color_rule ((DCELL *) v1, r1, g1, b1, (DCELL *) v2, r2, g2, b2, colors);.

Parameters:
v1 
r1 
g1 
b1 
v2 
r2 
g2 
b2 
colors 
map_type 
Returns:
int

Definition at line 121 of file color_rule.c.


Generated on Sun Apr 6 17:32:17 2008 for GRASS by  doxygen 1.5.5