[GRASS-SVN] r47043 - grass/trunk/lib/cairodriver

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jul 7 05:09:55 EDT 2011


Author: martinl
Date: 2011-07-07 02:09:55 -0700 (Thu, 07 Jul 2011)
New Revision: 47043

Modified:
   grass/trunk/lib/cairodriver/Graph.c
Log:
cairodriver: support also named and RGB colors for GRASS_BACKGROUNDCOLOR


Modified: grass/trunk/lib/cairodriver/Graph.c
===================================================================
--- grass/trunk/lib/cairodriver/Graph.c	2011-07-07 09:06:11 UTC (rev 47042)
+++ grass/trunk/lib/cairodriver/Graph.c	2011-07-07 09:09:55 UTC (rev 47043)
@@ -30,6 +30,7 @@
 #include <sys/mman.h>
 #endif
 
+#include <grass/colors.h>
 #include <grass/glocale.h>
 
 struct cairo_state ca;
@@ -233,7 +234,8 @@
     if (p && *p) {
 	unsigned int red, green, blue;
 
-	if (sscanf(p, "%02x%02x%02x", &red, &green, &blue) == 3) {
+	if (sscanf(p, "%02x%02x%02x", &red, &green, &blue) == 3 ||
+	    G_str_to_color(p, (int *)&red, (int *)&green, (int *)&blue) == 1) {
 	    ca.bgcolor_r = CAIROCOLOR(red);
 	    ca.bgcolor_g = CAIROCOLOR(green);
 	    ca.bgcolor_b = CAIROCOLOR(blue);



More information about the grass-commit mailing list