4 #include <grass/raster.h> 6 #define LOOKUP_COLORS 2048 8 static void organize_lookup(
struct Colors *,
int);
9 static int organize_fp_lookup(
struct Colors *,
int);
10 static int double_comp(
const void *,
const void *);
18 organize_lookup(colors, 0);
19 organize_lookup(colors, 1);
21 organize_fp_lookup(colors, 0);
22 organize_fp_lookup(colors, 1);
28 static int organize_fp_lookup(
struct Colors *colors,
int mod)
66 for (; rule; rule = rule->
prev) {
76 sizeof(
DCELL), &double_comp);
83 for (rule = cp->
rules; rule; rule = rule->
next)
84 if (rule->low.value <= val && val <= rule->
high.
value)
96 static void organize_lookup(
struct Colors *colors,
int mod)
120 for (i = 0; i < n; i++)
124 cp->
lookup.
red = (
unsigned char *)G_malloc(n);
125 cp->
lookup.
grn = (
unsigned char *)G_malloc(n);
126 cp->
lookup.
blu = (
unsigned char *)G_malloc(n);
127 cp->
lookup.
set = (
unsigned char *)G_malloc(n);
137 static int double_comp(
const void *xx,
const void *yy)
139 const DCELL *
x = xx, *y = yy;
struct _Color_Info_ fixed
struct _Color_Value_ low high
struct _Color_Rule_ * next
void Rast__organize_colors(struct Colors *colors)
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.
struct _Color_Info_::@3 lookup
struct _Color_Info_ modular
struct _Color_Info_::@4 fp_lookup
void G_zero(void *buf, int i)
Zero out a buffer, buf, of length i.
struct _Color_Rule_ * prev
struct _Color_Rule_ * rules