[GRASS-SVN] r38110 - in grass/trunk: include lib/display lib/ogsf
lib/raster raster/r.mapcalc raster/r.out.mpeg
raster/r.out.png raster/r.out.ppm raster/r.out.ppm3
raster/r.out.vrml visualization/xganim
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Jun 28 15:25:05 EDT 2009
Author: martinl
Date: 2009-06-28 15:25:03 -0400 (Sun, 28 Jun 2009)
New Revision: 38110
Modified:
grass/trunk/include/raster.h
grass/trunk/lib/display/raster.c
grass/trunk/lib/ogsf/Gs3.c
grass/trunk/lib/raster/color_get.c
grass/trunk/lib/raster/color_look.c
grass/trunk/lib/raster/get_row_colr.c
grass/trunk/raster/r.mapcalc/map.c
grass/trunk/raster/r.mapcalc/map3.c
grass/trunk/raster/r.out.mpeg/main.c
grass/trunk/raster/r.out.png/main.c
grass/trunk/raster/r.out.ppm/main.c
grass/trunk/raster/r.out.ppm3/main.c
grass/trunk/raster/r.out.vrml/put_grid.c
grass/trunk/visualization/xganim/main.cc
Log:
rasterlib: fns from color_look.c renamed, see
http://trac.osgeo.org/grass/wiki/Grass7/RasterLib
Modified: grass/trunk/include/raster.h
===================================================================
--- grass/trunk/include/raster.h 2009-06-28 19:00:33 UTC (rev 38109)
+++ grass/trunk/include/raster.h 2009-06-28 19:25:03 UTC (rev 38110)
@@ -136,25 +136,23 @@
int Rast_invert_colors(struct Colors *);
/* color_look.c */
-void Rast_lookup_colors(const CELL *, unsigned char *, unsigned char *,
- unsigned char *, unsigned char *, int, struct Colors *);
-void Rast_lookup_c_raster_colors(const CELL *, unsigned char *, unsigned char *,
- unsigned char *, unsigned char *, int,
- struct Colors *);
-void Rast_lookup_raster_colors(const void *, unsigned char *, unsigned char *,
- unsigned char *, unsigned char *, int,
- struct Colors *, RASTER_MAP_TYPE);
-void Rast_lookup_f_raster_colors(const FCELL *, unsigned char *, unsigned char *,
- unsigned char *, unsigned char *, int,
- struct Colors *);
-void Rast_lookup_d_raster_colors(const DCELL *, unsigned char *, unsigned char *,
- unsigned char *, unsigned char *, int,
- struct Colors *);
+void Rast_lookup_c_colors(const CELL *, unsigned char *, unsigned char *,
+ unsigned char *, unsigned char *, int,
+ struct Colors *);
+void Rast_lookup_colors(const void *, unsigned char *, unsigned char *,
+ unsigned char *, unsigned char *, int,
+ struct Colors *, RASTER_MAP_TYPE);
+void Rast_lookup_f_colors(const FCELL *, unsigned char *, unsigned char *,
+ unsigned char *, unsigned char *, int,
+ struct Colors *);
+void Rast_lookup_d_colors(const DCELL *, unsigned char *, unsigned char *,
+ unsigned char *, unsigned char *, int,
+ struct Colors *);
void Rast__lookup_colors(const void *, unsigned char *, unsigned char *,
- unsigned char *, unsigned char *, int, struct Colors *,
- int, int, RASTER_MAP_TYPE);
+ unsigned char *, unsigned char *, int, struct Colors *,
+ int, int, RASTER_MAP_TYPE);
void Rast__interpolate_color_rule(DCELL, unsigned char *, unsigned char *,
- unsigned char *, const struct _Color_Rule_ *);
+ unsigned char *, const struct _Color_Rule_ *);
/* color_org.c */
void Rast__organize_colors(struct Colors *);
Modified: grass/trunk/lib/display/raster.c
===================================================================
--- grass/trunk/lib/display/raster.c 2009-06-28 19:00:33 UTC (rev 38109)
+++ grass/trunk/lib/display/raster.c 2009-06-28 19:25:03 UTC (rev 38110)
@@ -100,7 +100,7 @@
set = G_realloc(set, nalloc);
}
- Rast_lookup_raster_colors(array, red, grn, blu, set, ncols, colors,
+ Rast_lookup_colors(array, red, grn, blu, set, ncols, colors,
data_type);
if (D__overlay_mode)
@@ -165,11 +165,11 @@
}
/* convert cell values to bytes */
- Rast_lookup_raster_colors(r_raster, r_buf, n_buf, n_buf, n_buf, ncols,
+ Rast_lookup_colors(r_raster, r_buf, n_buf, n_buf, n_buf, ncols,
r_colors, r_type);
- Rast_lookup_raster_colors(g_raster, n_buf, g_buf, n_buf, n_buf, ncols,
+ Rast_lookup_colors(g_raster, n_buf, g_buf, n_buf, n_buf, ncols,
g_colors, g_type);
- Rast_lookup_raster_colors(b_raster, n_buf, n_buf, b_buf, n_buf, ncols,
+ Rast_lookup_colors(b_raster, n_buf, n_buf, b_buf, n_buf, ncols,
b_colors, b_type);
if (D__overlay_mode)
Modified: grass/trunk/lib/ogsf/Gs3.c
===================================================================
--- grass/trunk/lib/ogsf/Gs3.c 2009-06-28 19:00:33 UTC (rev 38109)
+++ grass/trunk/lib/ogsf/Gs3.c 2009-06-28 19:25:03 UTC (rev 38110)
@@ -781,7 +781,7 @@
G_message(_("Translating colors from raster map <%s>..."), filename);
for (i = 0; i < rows; i++) {
- Rast_lookup_f_raster_colors(fcur, r, g, b, set, cols, &colrules);
+ Rast_lookup_f_colors(fcur, r, g, b, set, cols, &colrules);
G_percent(i, rows, 2);
for (j = 0; j < cols; j++) {
Modified: grass/trunk/lib/raster/color_get.c
===================================================================
--- grass/trunk/lib/raster/color_get.c 2009-06-28 19:00:33 UTC (rev 38109)
+++ grass/trunk/lib/raster/color_get.c 2009-06-28 19:25:03 UTC (rev 38110)
@@ -41,7 +41,7 @@
{
unsigned char r, g, b, set;
- Rast_lookup_raster_colors(rast, &r, &g, &b, &set, 1, colors, map_type);
+ Rast_lookup_colors(rast, &r, &g, &b, &set, 1, colors, map_type);
*red = (int)r;
*grn = (int)g;
Modified: grass/trunk/lib/raster/color_look.c
===================================================================
--- grass/trunk/lib/raster/color_look.c 2009-06-28 19:00:33 UTC (rev 38109)
+++ grass/trunk/lib/raster/color_look.c 2009-06-28 19:25:03 UTC (rev 38110)
@@ -20,8 +20,6 @@
/*!
* \brief Lookup an array of colors
*
- * \todo To be removed, replaced by Rast_lookup_c_raster_colors().
- *
* Extracts colors for an array of <i>cell</i> values. The colors
* for the <i>n</i> values in the <i>cell</i> array are stored in
* the <i>red, green</i>, and <i>blue</i> arrays. The values in the
@@ -44,44 +42,11 @@
* \param n number of values
* \param colors pointer to Colors structure which holds color info
*/
-void Rast_lookup_colors(const CELL * cell,
- unsigned char *red, unsigned char *grn,
- unsigned char *blu, unsigned char *set, int n,
- struct Colors *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)
{
- Rast_lookup_c_raster_colors(cell, red, grn, blu, set, n, colors);
-}
-
-/*!
- * \brief Lookup an array of colors
- *
- * Extracts colors for an array of <i>cell</i> values. The colors
- * for the <i>n</i> values in the <i>cell</i> array are stored in
- * the <i>red, green</i>, and <i>blue</i> arrays. The values in the
- * <i>set</i> array will indicate if the corresponding <i>cell</i>
- * value has a color or not (1 means it does, 0 means it does not).
- *
- * The programmer must allocate the <i>red, green, blue</i>, and
- * <b>set</b> arrays to be at least dimension <i>n</i>.
- *
- * <b>Note:</b> The <i>red, green</i>, and <i>blue</i> intensities
- * will be in the range 0 - 255.
- *
- * Modified to return a color for NULL-values.
- *
- * \param cell raster cell value
- * \param[out] red red value
- * \param[out] grn green value
- * \param[out] blu blue value
- * \param set array which indicates if color is set or not
- * \param n number of values
- * \param colors pointer to Colors structure which holds color info
- */
-void Rast_lookup_c_raster_colors(const CELL * cell,
- unsigned char *red, unsigned char *grn,
- unsigned char *blu, unsigned char *set, int n,
- struct Colors *colors)
-{
Rast__organize_colors(colors); /* make sure the lookup tables are in place */
G_zero((char *)set, n * sizeof(unsigned char));
@@ -99,8 +64,8 @@
* \brief Lookup an array of colors
*
* - If the <em>map_type</em> is CELL_TYPE, calls Rast_lookup_colors()
- * - If the <em>map_type</em> is FCELL_TYPE, calls Rast_lookup_f_raster_colors()
- * - If the <em>map_type</em> is DCELL_TYPE, calls Rast_lookup_d_raster_colors()
+ * - If the <em>map_type</em> is FCELL_TYPE, calls Rast_lookup_f_colors()
+ * - If the <em>map_type</em> is DCELL_TYPE, calls Rast_lookup_d_colors()
*
* \param raster raster cell value
* \param[out] red red value
@@ -111,10 +76,10 @@
* \param colors pointer to Colors structure which holds color info
* \param map_type raster type (CELL, FCELL, DCELL)
*/
-void Rast_lookup_raster_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)
+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)
{
Rast__organize_colors(colors); /* make sure the lookup tables are in place */
/* in case of float color rules, fp_lookup table is created */
@@ -143,9 +108,9 @@
* \param n number of values
* \param colors pointer to Colors structure which holds color info
*/
-void Rast_lookup_f_raster_colors(const FCELL * fcell, unsigned char *red,
- unsigned char *grn, unsigned char *blu,
- unsigned char *set, int n, struct Colors *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)
{
Rast__organize_colors(colors); /* make sure the lookup tables are in place */
/* in case of float color rules, fp_lookup table is created */
@@ -176,9 +141,9 @@
* \param n number of values
* \param colors pointer to Colors structure which holds color info
*/
-void Rast_lookup_d_raster_colors(const DCELL * dcell, unsigned char *red,
- unsigned char *grn, unsigned char *blu,
- unsigned char *set, int n, struct Colors *colors)
+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)
{
Rast__organize_colors(colors); /* make sure the lookup tables are in place */
/* in case of float color rules, fp_lookup table is created */
@@ -226,9 +191,9 @@
* \param data_type raster type (CELL, FCELL, 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,
- int mod, int rules_only, RASTER_MAP_TYPE data_type)
+ unsigned char *grn, unsigned char *blu,
+ unsigned char *set, int n, struct Colors *colors,
+ int mod, int rules_only, RASTER_MAP_TYPE data_type)
{
struct _Color_Info_ *cp;
struct _Color_Rule_ *rule;
@@ -448,8 +413,8 @@
\param rule pointer to _Color_Rule which holds color rules info
*/
void Rast__interpolate_color_rule(DCELL val, unsigned char *red,
- unsigned char *grn, unsigned char *blu,
- const struct _Color_Rule_ *rule)
+ unsigned char *grn, unsigned char *blu,
+ const struct _Color_Rule_ *rule)
{
DCELL delta;
Modified: grass/trunk/lib/raster/get_row_colr.c
===================================================================
--- grass/trunk/lib/raster/get_row_colr.c 2009-06-28 19:00:33 UTC (rev 38109)
+++ grass/trunk/lib/raster/get_row_colr.c 2009-06-28 19:25:03 UTC (rev 38110)
@@ -62,7 +62,7 @@
set = G__alloca(cols);
- Rast_lookup_raster_colors(array, red, grn, blu, set, cols, colors, type);
+ Rast_lookup_colors(array, red, grn, blu, set, cols, colors, type);
G__freea(array);
G__freea(set);
Modified: grass/trunk/raster/r.mapcalc/map.c
===================================================================
--- grass/trunk/raster/r.mapcalc/map.c 2009-06-28 19:00:33 UTC (rev 38109)
+++ grass/trunk/raster/r.mapcalc/map.c 2009-06-28 19:25:03 UTC (rev 38110)
@@ -232,7 +232,7 @@
unsigned char *set = G__alloca(columns);
int i;
- Rast_lookup_d_raster_colors(rast, red, grn, blu, set, ncols, &m->colors);
+ Rast_lookup_d_colors(rast, red, grn, blu, set, ncols, &m->colors);
switch (mod) {
case 'r':
Modified: grass/trunk/raster/r.mapcalc/map3.c
===================================================================
--- grass/trunk/raster/r.mapcalc/map3.c 2009-06-28 19:00:33 UTC (rev 38109)
+++ grass/trunk/raster/r.mapcalc/map3.c 2009-06-28 19:25:03 UTC (rev 38110)
@@ -200,7 +200,7 @@
{
int i;
- Rast_lookup_d_raster_colors(rast, red, grn, blu, set, ncols, &m->colors);
+ Rast_lookup_d_colors(rast, red, grn, blu, set, ncols, &m->colors);
switch (mod) {
case 'r':
Modified: grass/trunk/raster/r.out.mpeg/main.c
===================================================================
--- grass/trunk/raster/r.out.mpeg/main.c 2009-06-28 19:00:33 UTC (rev 38109)
+++ grass/trunk/raster/r.out.mpeg/main.c 2009-06-28 19:25:03 UTC (rev 38110)
@@ -298,7 +298,7 @@
G_fatal_error(_("Error reading row <%d>"), row);
rowoff = (vyoff + row) * ncols;
- Rast_lookup_raster_colors(voidc, tr, tg, tb,
+ Rast_lookup_colors(voidc, tr, tg, tb,
tset, tsiz, &colors, rtype);
for (col = 0; col < vcols; col++) {
Modified: grass/trunk/raster/r.out.png/main.c
===================================================================
--- grass/trunk/raster/r.out.png/main.c 2009-06-28 19:00:33 UTC (rev 38109)
+++ grass/trunk/raster/r.out.png/main.c 2009-06-28 19:25:03 UTC (rev 38110)
@@ -254,8 +254,8 @@
G_percent(row, w.rows, 5);
if (Rast_get_raster_row(cellfile, (void *)voidc, row, rtype) < 0)
exit(EXIT_FAILURE);
- Rast_lookup_raster_colors((void *)voidc, ored, ogrn, oblu, set,
- w.cols, &colors, rtype);
+ Rast_lookup_colors((void *)voidc, ored, ogrn, oblu, set,
+ w.cols, &colors, rtype);
pp = line;
Modified: grass/trunk/raster/r.out.ppm/main.c
===================================================================
--- grass/trunk/raster/r.out.ppm/main.c 2009-06-28 19:00:33 UTC (rev 38109)
+++ grass/trunk/raster/r.out.ppm/main.c 2009-06-28 19:25:03 UTC (rev 38110)
@@ -166,8 +166,8 @@
if (Rast_get_raster_row(cellfile, (void *)voidc, row, rtype) < 0)
G_fatal_error(_("Unable to read raster map <%s> row %d"),
rast->answer, row);
- Rast_lookup_raster_colors((void *)voidc, ored, ogrn, oblu, set,
- w.cols, &colors, rtype);
+ Rast_lookup_colors((void *)voidc, ored, ogrn, oblu, set,
+ w.cols, &colors, rtype);
for (col = 0; col < w.cols; col++) {
if (set[col]) {
@@ -189,8 +189,8 @@
G_percent(row, w.rows, 5);
if (Rast_get_raster_row(cellfile, (void *)voidc, row, rtype) < 0)
exit(1);
- Rast_lookup_raster_colors((void *)voidc, ored, ogrn, oblu, set,
- w.cols, &colors, rtype);
+ Rast_lookup_colors((void *)voidc, ored, ogrn, oblu, set,
+ w.cols, &colors, rtype);
for (col = 0; col < w.cols; col++) {
Modified: grass/trunk/raster/r.out.ppm3/main.c
===================================================================
--- grass/trunk/raster/r.out.ppm3/main.c 2009-06-28 19:00:33 UTC (rev 38109)
+++ grass/trunk/raster/r.out.ppm3/main.c 2009-06-28 19:25:03 UTC (rev 38110)
@@ -162,7 +162,7 @@
if (Rast_get_raster_row(B[i].file, B[i].array, row, B[i].type) < 0)
G_fatal_error("Rast_get_raster_row failed");
- Rast_lookup_raster_colors(B[i].array,
+ Rast_lookup_colors(B[i].array,
(i == 0) ? B[i].buf : dummy,
(i == 1) ? B[i].buf : dummy,
(i == 2) ? B[i].buf : dummy,
Modified: grass/trunk/raster/r.out.vrml/put_grid.c
===================================================================
--- grass/trunk/raster/r.out.vrml/put_grid.c 2009-06-28 19:00:33 UTC (rev 38109)
+++ grass/trunk/raster/r.out.vrml/put_grid.c 2009-06-28 19:25:03 UTC (rev 38110)
@@ -100,7 +100,7 @@
G_percent(row, rows - 1, 5);
Rast_get_f_raster_row(colorfd, tf, row);
- Rast_lookup_f_raster_colors(tf, red, green, blue, set, cols, colr);
+ Rast_lookup_f_colors(tf, red, green, blue, set, cols, colr);
for (col = 0; col < cols; col++) {
sprintf(str, "%.3f %.3f %.3f,",
Modified: grass/trunk/visualization/xganim/main.cc
===================================================================
--- grass/trunk/visualization/xganim/main.cc 2009-06-28 19:00:33 UTC (rev 38109)
+++ grass/trunk/visualization/xganim/main.cc 2009-06-28 19:25:03 UTC (rev 38110)
@@ -248,7 +248,7 @@
G_fatal_error(_("Unable to read raster row"));
rowoff = (vyoff + row) * ncols;
- Rast_lookup_d_raster_colors(dcell, tr, tg, tb, tset, tsiz, &colors);
+ Rast_lookup_d_colors(dcell, tr, tg, tb, tset, tsiz, &colors);
for (col = 0; col < vcols; col++) {
coff = (int)(col / vscale);
More information about the grass-commit
mailing list