[GRASS-dev] Rast_add_d_colour

Markus Metz markus.metz.giswork at gmail.com
Sat Dec 6 12:59:10 PST 2014


Yann Chemin wrote:
> Hi,
>
> I am working on beautifying the output of i.theilsen, a new addon.
>
> For some reason, I cannot apply a grayscale palette.
> ---------------
> Rast_init_colors(&colors);
> DCELL val1 = ts_min;
> DCELL val2 = ceil(ts_max);
> Rast_add_d_color_rule(&val1, 0, 0, 0, &val2, 255, 255, 255, &colors);
> ---------------
>
> ts_min, ts_max are known from the data processed,
> val1 and val2 are declared as DCELL instead of const DCELL as required,
> but if I declare const DCELL val1, then I cannot write stats to it for
> palette definition...
>
> What I am doing wrong?

If you declare const DCELL val1, you can not pass a pointer to val1 to
another function, because this other function could then easily modify
to contents of that pointer. Rast_add_d_color_rule() requires const
DCELL *, not const DCELL.

Markus M


More information about the grass-dev mailing list