17 #define LIMIT(x) if (x < 0) x = 0; else if (x > 255) x = 255; 19 static void add_color_rule(
const void *,
int,
int,
int,
20 const void *,
int,
int,
int,
36 const DCELL * val2,
int r2,
int g2,
int b2,
39 add_color_rule(val1, r1, g1, b1, val2, r2, g2, b2, &colors->
fixed,
56 const FCELL * cat2,
int r2,
int g2,
int b2,
59 add_color_rule(cat1, r1, g1, b1, cat2, r2, g2, b2, &colors->
fixed,
76 const CELL * cat2,
int r2,
int g2,
int b2,
79 add_color_rule(cat1, r1, g1, b1, cat2, r2, g2, b2, &colors->
fixed,
105 const void *val2,
int r2,
int g2,
int b2,
108 add_color_rule(val1, r1, g1, b1, val2, r2, g2, b2, &colors->
fixed,
125 const DCELL * val2,
int r2,
int g2,
int b2,
134 add_color_rule(val1, r1, g1, b1, val2, r2, g2, b2, &colors->
modular, 0,
155 const FCELL * val2,
int r2,
int g2,
int b2,
164 add_color_rule(val1, r1, g1, b1, val2, r2, g2, b2, &colors->
modular, 0,
185 const CELL * val2,
int r2,
int g2,
int b2,
194 add_color_rule(val1, r1, g1, b1, val2, r2, g2, b2, &colors->
modular, 0,
219 const void *val2,
int r2,
int g2,
int b2,
229 add_color_rule(val1, r1, g1, b1, val2, r2, g2, b2, &colors->
modular, 0,
230 &colors->
cmin, &colors->
cmax, data_type);
237 static void add_color_rule(
const void *pt1,
int r1,
int g1,
int b1,
238 const void *pt2,
int r2,
int g2,
int b2,
243 unsigned char red, grn, blu;
264 rule->low.value = rule->
high.
value = val1;
265 rule->low.red = rule->
high.
red = (r1 + r2) / 2;
266 rule->low.grn = rule->
high.
grn = (g1 + g2) / 2;
267 rule->low.blu = rule->
high.
blu = (b1 + b2) / 2;
269 else if (val1 < val2) {
270 rule->low.value = val1;
281 rule->low.value = val2;
297 min = rule->low.value;
348 min = rule->low.value;
351 for (rule = rule->
next; rule; rule = next) {
353 if (min <= rule->low.value && max >= rule->
high.
value) {
struct _Color_Info_ fixed
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)
DCELL Rast_get_d_value(const void *, RASTER_MAP_TYPE)
Retrieves the value of given type from pointer p (DCELL)
#define Rast_is_d_null_value(dcellVal)
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)
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.
struct _Color_Value_ low high
void G_free(void *)
Free allocated memory.
struct _Color_Rule_ * next
void Rast__interpolate_color_rule(DCELL, unsigned char *, unsigned char *, unsigned char *, const struct _Color_Rule_ *)
Interpolate color rules.
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)
int Rast__insert_color_into_lookup(CELL, int, int, int, struct _Color_Info_ *)
void Rast__color_free_lookup(struct _Color_Info_ *)
Free color rules structure.
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)
void Rast__color_free_fp_lookup(struct _Color_Info_ *)
Free color rules structure.
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)
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.
struct _Color_Info_ modular
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)
struct _Color_Rule_ * prev
struct _Color_Rule_ * rules