46 unsigned char *grn,
unsigned char *blu,
47 unsigned char *set,
int n,
struct Colors *colors)
52 G_zero((
char *)set, n *
sizeof(
unsigned char));
80 unsigned char *grn,
unsigned char *blu,
81 unsigned char *set,
int n,
struct Colors *colors,
88 G_zero((
char *)set, n *
sizeof(
unsigned char));
113 unsigned char *grn,
unsigned char *blu,
114 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)
154 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;
209 int (*lower)(double, double);
231 shift = invert = lookup = mod = 0;
242 shift = colors->
shift;
279 if (shift && val >= dmin && val <= dmax) {
282 val += dmax - dmin + 1;
284 val -= dmax - dmin + 1;
289 val = dmin + dmax - val;
296 val = val - dmod * floor(val / dmod);
311 if (lookup && ((
double)cat - val == 0.)) {
312 if (cat >=
min && cat <=
max) {
341 lower = less_or_equal;
353 try = (max_ind + min_ind) / 2;
354 if (min_ind > max_ind) {
364 try = (max_ind + min_ind) / 2;
365 if (max_ind < min_ind) {
377 for (rule = cp->
rules; rule; rule = rule->
next) {
382 if (rule->low.value <= val && val <= rule->
high.
value)
423 unsigned char *grn,
unsigned char *blu,
428 if ((delta = rule->
high.
value - rule->low.value)) {
429 val -= rule->low.value;
431 *red = (int)(val * (
double)((int)rule->
high.
red - (
int)rule->low.red) /
434 *grn = (
int)(val * (double)((
int)rule->
high.
grn - (int)rule->low.grn) /
437 *blu = (int)(val * (
double)((int)rule->
high.
blu - (
int)rule->low.blu) /
442 *red = rule->low.red;
443 *grn = rule->low.grn;
444 *blu = rule->low.blu;
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 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)
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)
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.
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.
void Rast__interpolate_color_rule(DCELL val, unsigned char *red, unsigned char *grn, unsigned char *blu, const struct _Color_Rule_ *rule)
Interpolate color rules.
void G_zero(void *, int)
Zero out a buffer, buf, of length i.
#define G_incr_void_ptr(ptr, size)
int Rast_is_null_value(const void *, RASTER_MAP_TYPE)
To check if a raster value is set to NULL.
size_t Rast_cell_size(RASTER_MAP_TYPE)
Returns size of a raster cell in bytes.
void Rast__organize_colors(struct Colors *)
void Rast_get_null_value_color(int *, int *, int *, const struct Colors *)
Gets color for null value.
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_get_default_color(int *, int *, int *, const struct Colors *)
Gets default color.
struct _Color_Info_ fixed
struct _Color_Info_ modular
struct _Color_Info_::@3 lookup
struct _Color_Info_::@4 fp_lookup
struct _Color_Rule_ * rules
struct _Color_Rule_ * next
struct _Color_Value_ low high