[GRASS-SVN] r47701 - grass/trunk/ps/ps.map

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Aug 17 08:47:55 EDT 2011


Author: hamish
Date: 2011-08-17 05:47:55 -0700 (Wed, 17 Aug 2011)
New Revision: 47701

Modified:
   grass/trunk/ps/ps.map/ps_info.h
   grass/trunk/ps/ps.map/ps_outline.c
Log:
full RGB support for raster clump outlining (#192, merge from devbr6)

Modified: grass/trunk/ps/ps.map/ps_info.h
===================================================================
--- grass/trunk/ps/ps.map/ps_info.h	2011-08-17 12:47:37 UTC (rev 47700)
+++ grass/trunk/ps/ps.map/ps_info.h	2011-08-17 12:47:55 UTC (rev 47701)
@@ -50,7 +50,8 @@
     int geogrid, geogrid_numbers, geogrid_fontsize;
     PSCOLOR geogrid_color, geogrid_numbers_color;
     double grid_width, geogrid_width;
-    int do_outline, outline_color;
+    int do_outline;
+    PSCOLOR outline_color;
     int cell_fd;
     int row_delta, col_delta;
     int cells_wide, cells_high;

Modified: grass/trunk/ps/ps.map/ps_outline.c
===================================================================
--- grass/trunk/ps/ps.map/ps_outline.c	2011-08-17 12:47:37 UTC (rev 47700)
+++ grass/trunk/ps/ps.map/ps_outline.c	2011-08-17 12:47:55 UTC (rev 47701)
@@ -8,7 +8,9 @@
 #include <string.h>
 #include <grass/gis.h>
 #include <grass/raster.h>
+#include <grass/colors.h>
 #include <grass/glocale.h>
+#include "clr.h"
 #include "local_proto.h"
 
 static int k, col, row, top, bottom;
@@ -42,7 +44,7 @@
 	      PS.cell_name, PS.cell_mapset);
 
     /* set the outline color and width */
-    set_rgb_color(PS.outline_color);
+    set_ps_color(&PS.outline_color);
     set_line_width(PS.outline_width);
 
     /* create temporary vector map containing outlines */
@@ -66,35 +68,43 @@
 {
     char buf[1024];
     char ch, *key, *data;
-    int color;
+    PSCOLOR color;
+    int ret, r, g, b;
 
     PS.outline_width = 1.;
-    color = BLACK;
+    set_color(&color, 0, 0, 0);
+
     while (input(2, buf, help)) {
 	if (!key_data(buf, &key, &data))
 	    continue;
+
 	if (KEY("color")) {
-	    color = get_color_number(data);
-	    if (color < 0) {
-		color = BLACK;
-		error(key, data, "illegal color request");
-	    }
+	    ret = G_str_to_color(data, &r, &g, &b);
+	    if (ret == 1)
+		set_color(&color, r, g, b);
+	    else if (ret == 2)  /* i.e. "none" */
+		/* unset_color(&color); */
+		error(key, data, _("Unsupported color request"));
+	    else
+		error(key, data, _("illegal color request")); 
+
 	    continue;
 	}
+
 	if (KEY("width")) {
 	    PS.outline_width = -1.;
 	    ch = ' ';
 	    if (sscanf(data, "%lf%c", &(PS.outline_width), &ch) < 1
 		|| PS.outline_width < 0.) {
 		PS.outline_width = 1.;
-		error(key, data, "illegal width request");
+		error(key, data, _("illegal width request"));
 	    }
 	    if (ch == 'i')
 		PS.outline_width = PS.outline_width / 72.;
 	    continue;
 	}
-	error(key, data, "illegal outline sub-request");
-	error(key, data, "illegal outline sub-request");
+
+	error(key, data, _("illegal outline sub-request"));
     }
     PS.outline_color = color;
     PS.do_outline = 1;



More information about the grass-commit mailing list