46 unsigned char *red,
unsigned char *grn,
47 unsigned char *blu,
unsigned char *
set,
int n,
52 G_zero((
char *)
set, n *
sizeof(
unsigned char));
80 unsigned char *red,
unsigned char *grn,
81 unsigned char *blu,
unsigned char *
set,
int n,
87 G_zero((
char *)
set, n *
sizeof(
unsigned char));
114 unsigned char *grn,
unsigned char *blu,
115 unsigned char *
set,
int n,
struct Colors *colors)
120 G_zero((
char *)
set, n *
sizeof(
unsigned char));
147 unsigned char *grn,
unsigned char *blu,
148 unsigned char *
set,
int n,
struct Colors *colors)
153 G_zero((
char *)
set, n *
sizeof(
unsigned char));
165 static int less_or_equal(
double x,
double y)
173 static int less(
double x,
double y)
196 unsigned char *grn,
unsigned char *blu,
197 unsigned char *
set,
int n,
struct Colors *colors,
202 DCELL dmin, dmax, val, dmod = 0L, shift;
204 const void *ptr, *last_ptr =
NULL;
208 int lookup, max_ind, min_ind,
try;
231 shift = invert = lookup = mod = 0;
242 shift = colors->
shift;
251 red++, grn++, blu++, *
set++ = found) {
280 if (shift && val >= dmin && val <= dmax) {
283 val += dmax - dmin + 1;
285 val -= dmax - dmin + 1;
290 val = dmin + dmax - val;
297 val = val - dmod * floor(val / dmod);
312 if (lookup && ((
double)cat - val == 0.)) {
313 if (cat >= min && cat <= max) {
341 lower = less_or_equal;
352 try = (max_ind + min_ind) / 2;
353 if (min_ind > max_ind) {
362 try = (max_ind + min_ind) / 2;
363 if (max_ind < min_ind) {
375 for (rule = cp->
rules; rule; rule = rule->
next) {
380 if (rule->low.value <= val && val <= rule->
high.
value)
418 unsigned char *grn,
unsigned char *blu,
423 if ((delta = rule->
high.
value - rule->low.value)) {
424 val -= rule->low.value;
427 (int)(val * (
double)((int)rule->
high.
red - (
int)rule->low.red) /
429 + (int)rule->low.red;
431 (
int)(val * (double)((
int)rule->
high.
grn - (int)rule->low.grn) /
433 + (
int)rule->low.grn;
435 (int)(val * (
double)((int)rule->
high.
blu - (
int)rule->low.blu) /
437 + (int)rule->low.blu;
440 *red = rule->low.red;
441 *grn = rule->low.grn;
442 *blu = rule->low.blu;
struct _Color_Info_ fixed
void Rast_lookup_d_colors(const DCELL *dcell, unsigned char *red, unsigned char *grn, unsigned char *blu, unsigned char *set, int n, struct Colors *colors)
Lookup an array of colors (DCELL)
int Rast_raster_cmp(const void *, const void *, RASTER_MAP_TYPE)
Compares raster values.
DCELL Rast_get_d_value(const void *, RASTER_MAP_TYPE)
Retrieves the value of given type from pointer p (DCELL)
void Rast_lookup_f_colors(const FCELL *fcell, unsigned char *red, unsigned char *grn, unsigned char *blu, unsigned char *set, int n, struct Colors *colors)
Lookup an array of colors (FCELL)
struct _Color_Value_ low high
struct _Color_Rule_ * next
void Rast_lookup_colors(const void *raster, unsigned char *red, unsigned char *grn, unsigned char *blu, unsigned char *set, int n, struct Colors *colors, RASTER_MAP_TYPE map_type)
Lookup an array of colors.
#define G_incr_void_ptr(ptr, size)
void Rast_get_default_color(int *, int *, int *, const struct Colors *)
Gets default color.
size_t Rast_cell_size(RASTER_MAP_TYPE)
Returns size of a raster cell in bytes.
void Rast_get_null_value_color(int *, int *, int *, const struct Colors *)
Gets color for null value.
void Rast__lookup_colors(const void *raster, unsigned char *red, unsigned char *grn, unsigned char *blu, unsigned char *set, int n, struct Colors *colors, int mod, int rules_only, RASTER_MAP_TYPE data_type)
Lookup an array of colors.
void G_zero(void *, int)
Zero out a buffer, buf, of length i.
void Rast__organize_colors(struct Colors *)
void Rast_lookup_c_colors(const CELL *cell, unsigned char *red, unsigned char *grn, unsigned char *blu, unsigned char *set, int n, struct Colors *colors)
Lookup an array of colors.
struct _Color_Info_::@3 lookup
struct _Color_Info_ modular
struct _Color_Info_::@4 fp_lookup
void Rast__interpolate_color_rule(DCELL val, unsigned char *red, unsigned char *grn, unsigned char *blu, const struct _Color_Rule_ *rule)
Interpolate color rules.
int Rast_is_null_value(const void *, RASTER_MAP_TYPE)
To check if a raster value is set to NULL.
struct _Color_Rule_ * rules