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));
165static int less_or_equal(
double x,
double y)
173static int less(
double x,
double y)
196 unsigned char *grn,
unsigned char *blu,
197 unsigned char *set,
int n,
struct Colors *colors,
231 shift = invert = lookup =
mod = 0;
242 shift = colors->
shift;
244 lookup =
cp->lookup.active;
279 if (shift && val >= dmin && val <=
dmax) {
282 val +=
dmax - dmin + 1;
284 val -=
dmax - dmin + 1;
289 val = dmin +
dmax - val;
311 if (lookup && ((
double)cat - val == 0.)) {
312 if (cat >=
min && cat <=
max) {
314 if (
cp->lookup.set[cat]) {
315 *red =
cp->lookup.red[cat];
316 *grn =
cp->lookup.grn[cat];
317 *blu =
cp->lookup.blu[cat];
331 if (
cp->fp_lookup.active) {
332 try = (
cp->fp_lookup.nalloc - 1) / 2;
338 if (
cp->fp_lookup.rules[
try])
341 lower = less_or_equal;
348 if (lower(
cp->fp_lookup.vals[
try + 1],
360 if (lower(val,
cp->fp_lookup.vals[
try])) {
371 rule =
cp->fp_lookup.rules[
try];
377 for (rule =
cp->rules; rule; rule = rule->
next) {
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_Rule_ * next
struct _Color_Value_ low high