[GRASS-SVN] r52208 - in grass/branches/develbranch_6/imagery: i.his.rgb i.rgb.his

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jun 25 14:50:14 PDT 2012


Author: hamish
Date: 2012-06-25 14:50:13 -0700 (Mon, 25 Jun 2012)
New Revision: 52208

Modified:
   grass/branches/develbranch_6/imagery/i.his.rgb/h2rmain.c
   grass/branches/develbranch_6/imagery/i.his.rgb/his2rgb.c
   grass/branches/develbranch_6/imagery/i.rgb.his/r2hmain.c
   grass/branches/develbranch_6/imagery/i.rgb.his/rgb2his.c
Log:
add NULL support (thanks Glynn)

Modified: grass/branches/develbranch_6/imagery/i.his.rgb/h2rmain.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.his.rgb/h2rmain.c	2012-06-25 19:57:03 UTC (rev 52207)
+++ grass/branches/develbranch_6/imagery/i.his.rgb/h2rmain.c	2012-06-25 21:50:13 UTC (rev 52208)
@@ -91,7 +91,7 @@
 
 	/* read in a row from each cell map */
 	for (band = 0; band < 3; band++)
-	    if (G_get_map_row(fd_input[band], rowbuffer[band], i) < 0)
+	    if (G_get_c_raster_row(fd_input[band], rowbuffer[band], i) < 0)
 		G_fatal_error(_("Unable to read raster map row %ld"), i);
 
 	/* process this row of the map */

Modified: grass/branches/develbranch_6/imagery/i.his.rgb/his2rgb.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.his.rgb/his2rgb.c	2012-06-25 19:57:03 UTC (rev 52207)
+++ grass/branches/develbranch_6/imagery/i.his.rgb/his2rgb.c	2012-06-25 21:50:13 UTC (rev 52208)
@@ -37,6 +37,15 @@
 
 
     for (sample = 0; sample < columns; sample++) {
+	if (G_is_c_null_value(&rowbuffer[0][sample]) ||
+	    G_is_c_null_value(&rowbuffer[1][sample]) ||
+	    G_is_c_null_value(&rowbuffer[2][sample])) {
+	    G_set_c_null_value(&rowbuffer[0][sample], 1);
+	    G_set_c_null_value(&rowbuffer[1][sample], 1);
+	    G_set_c_null_value(&rowbuffer[2][sample], 1);
+	    continue;
+	}
+
 	red = green = blue = 0.0;
 	scalei = (double)rowbuffer[1][sample];
 	scalei /= 255.;

Modified: grass/branches/develbranch_6/imagery/i.rgb.his/r2hmain.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.rgb.his/r2hmain.c	2012-06-25 19:57:03 UTC (rev 52207)
+++ grass/branches/develbranch_6/imagery/i.rgb.his/r2hmain.c	2012-06-25 21:50:13 UTC (rev 52208)
@@ -89,7 +89,7 @@
 	G_percent(i, rows, 2);
 
 	for (band = 0; band < 3; band++)
-	    if (G_get_map_row(fd_input[band], rowbuffer[band], i) < 0)
+	    if (G_get_c_raster_row(fd_input[band], rowbuffer[band], i) < 0)
 		G_fatal_error(_("Unable to read raster map row %ld"), i);
 
 	/* process this row of the map */

Modified: grass/branches/develbranch_6/imagery/i.rgb.his/rgb2his.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.rgb.his/rgb2his.c	2012-06-25 19:57:03 UTC (rev 52207)
+++ grass/branches/develbranch_6/imagery/i.rgb.his/rgb2his.c	2012-06-25 21:50:13 UTC (rev 52208)
@@ -35,6 +35,15 @@
     double hue = 0.0L;		/* hue                                   */
 
     for (sample = 0; sample < columns; sample++) {
+	if (G_is_c_null_value(&rowbuffer[0][sample]) ||
+	    G_is_c_null_value(&rowbuffer[1][sample]) ||
+	    G_is_c_null_value(&rowbuffer[2][sample])) {
+	    G_set_c_null_value(&rowbuffer[0][sample], 1);
+	    G_set_c_null_value(&rowbuffer[1][sample], 1);
+	    G_set_c_null_value(&rowbuffer[2][sample], 1);
+	    continue;
+	}
+
 	scaler = (double)rowbuffer[0][sample];
 	scaler /= 255.0;
 	scaleg = (double)rowbuffer[1][sample];



More information about the grass-commit mailing list