GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
color_set.c
Go to the documentation of this file.
1 #include <grass/gis.h>
2 
3 /* for convenience, but to be avoided if possible */
4 
28 int G_set_color(CELL cat, int r, int g, int b, struct Colors *colors)
29 {
30  CELL tmp = cat;
31 
32  if (G_is_c_null_value(&tmp))
33  return G_set_null_value_color(r, g, b, colors);
34  return G_add_color_rule(cat, r, g, b, cat, r, g, b, colors);
35 }
36 
37 int G_set_d_color(DCELL val, int r, int g, int b, struct Colors *colors)
38 {
39  DCELL tmp = val;
40 
41  if (G_is_d_null_value(&tmp))
42  return G_set_null_value_color(r, g, b, colors);
43  return G_add_d_raster_color_rule(&val, r, g, b, &val, r, g, b, colors);
44 }
45 
46 
59 int G_set_null_value_color(int red, int grn, int blu, struct Colors *colors)
60 {
61  colors->null_red = red;
62  colors->null_grn = grn;
63  colors->null_blu = blu;
64  colors->null_set = 1;
65  return 1;
66 }
67 
68 
82 int G_set_default_color(int red, int grn, int blu, struct Colors *colors)
83 {
84  colors->undef_red = red;
85  colors->undef_grn = grn;
86  colors->undef_blu = blu;
87  colors->undef_set = 1;
88  return 1;
89 }
int G_is_c_null_value(const CELL *cellVal)
Returns 1 if cell is NULL, 0 otherwise. This will test if the value cell is the largest int...
Definition: null_val.c:244
int G_set_default_color(int red, int grn, int blu, struct Colors *colors)
Sets the default color (in colors) to r,g,b. This is the color for values which do not have an explic...
Definition: color_set.c:82
float b
Definition: named_colr.c:8
int G_set_null_value_color(int red, int grn, int blu, struct Colors *colors)
Sets the color (in colors) for the NULL-value to r,g,b.
Definition: color_set.c:59
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)
Definition: color_rule.c:41
float r
Definition: named_colr.c:8
int G_set_color(CELL cat, int r, int g, int b, struct Colors *colors)
set a category color
Definition: color_set.c:28
int G_set_d_color(DCELL val, int r, int g, int b, struct Colors *colors)
Definition: color_set.c:37
int G_is_d_null_value(const DCELL *dcellVal)
Returns 1 if dcell is NULL, 0 otherwise. This will test if the value dcell is a NaN. Same test as in G_is_f_null_value().
Definition: null_val.c:306
DCELL val
Definition: color_rules.c:31
float g
Definition: named_colr.c:8
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.
Definition: color_rule.c:165
CELL cat
Definition: g3dcats.c:90