Thanks, Will try again today. On Dec 7, 2014 3:36 AM, "Vaclav Petras" <wenzesl...@gmail.com> wrote:
> > > On Sat, Dec 6, 2014 at 3:59 PM, Markus Metz <markus.metz.gisw...@gmail.com > > wrote: > >> 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. > > > This is of course true. > > >> Rast_add_d_color_rule() requires const >> DCELL *, not const DCELL. >> > > Strange, (generated) documentation says const DCELL * [1] which fits with > the source code [2, 3]. > > I haven't tried compile anything now but isn't `const DCELL` constant > (value) and `const DCELL *` pointer to constant value. While `const DCELL * > const` would be constant pointer to constant value. > > Also > > const DCELL val; > const DCELL * pval = &val; > > should work and carry on the constness which is exactly what should be > happening when calling the Rast_add_d_color_rule() function. > > So, I don't understand. > > Vaclav > > [1] > http://grass.osgeo.org/programming7/color__rule_8c.html#a160535a46694589674f68c60eac23a05 > [2] lib/raster/color_rule.c:35:void Rast_add_d_color_rule(const DCELL * > val1, int r1, int g1, int b1, ... > [3] include/defs/raster.h:198:void Rast_add_d_color_rule(const DCELL *, > int, int, int, ... > > >> Markus M >> _______________________________________________ >> grass-dev mailing list >> grass-dev@lists.osgeo.org >> http://lists.osgeo.org/mailman/listinfo/grass-dev >> > >
_______________________________________________ grass-dev mailing list grass-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-dev