42 #include <grass/gis.h>
60 struct Colors *src,
struct Cell_stats *statf)
64 long count, total, sum;
100 x = min + (max -
min) * (sum + count / 2.0) / total;
133 struct Colors *src,
struct FP_stats *statf)
158 for (i = 0; i <= statf->count; i++) {
159 int red2, grn2, blu2;
162 val2 = statf->min + (statf->max - statf->min) * i / statf->count;
163 if (statf->geometric)
166 val2 = exp(val2) - 1;
169 x = min + (max -
min) * sum / statf->total;
176 if (i == statf->count)
179 sum += statf->stats[i];
218 for (i = 0; i <= samples; i++) {
219 int red2, grn2, blu2;
223 y = min + (max -
min) * i / samples;
228 else if (i == samples)
231 lx = lmin + (lmax - lmin) * i / samples;
237 &x, red2, grn2, blu2,
272 lmin =
log(fabs(min) + 1.0);
273 lmax =
log(fabs(max) + 1.0);
275 amax = fabs(min) > fabs(max) ? fabs(min) : fabs(max);
276 lamax = lmin > lmax ? lmin : lmax;
284 for (i = 0; i <= samples; i++) {
285 int red2, grn2, blu2;
289 y = min + (max -
min) * i / samples;
294 else if (i == samples)
297 lx = 0 + lamax * i / samples;
302 DCELL x0 = prev, x1 = x;
304 &x1, red2, grn2, blu2,
309 &x1, red2, grn2, blu2,
int G_set_default_color(int red, int grn, int blu, struct Colors *colors)
Sets the default color (in colors) to r,g,b. This is the color for values which do not have an explic...
int G_set_null_value_color(int red, int grn, int blu, struct Colors *colors)
Sets the color (in colors) for the NULL-value to r,g,b.
int G_get_null_value_color(int *red, int *grn, int *blu, const struct Colors *colors)
Gets color for null value.
int G_add_d_raster_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 rule (DCELL version)
int G_next_cell_stat(CELL *cat, long *count, struct Cell_stats *s)
retrieve sorted cell stats
int G_get_d_raster_color(const DCELL *rast, int *red, int *grn, int *blu, struct Colors *colors)
Gets color for a DCELL raster.
int G_get_default_color(int *red, int *grn, int *blu, const struct Colors *colors)
Gets default color.
int G_get_d_color_range(DCELL *min, DCELL *max, const struct Colors *colors)
int G_rewind_cell_stats(struct Cell_stats *s)
reset/rewind cell stats
int G_add_color_rule(CELL cat1, int r1, int g1, int b1, CELL cat2, int r2, int g2, int b2, struct Colors *colors)
Set colors rules.