[cairo-commit] goocanvas/demo demo.c,1.31,1.32

Damon Chaplin commit at pdx.freedesktop.org
Sun Mar 23 16:30:07 PDT 2008


Committed by: damon

Update of /cvs/cairo/goocanvas/demo
In directory kemper:/tmp/cvs-serv31360/demo

Modified Files:
	demo.c 
Log Message:
2008-03-23  Damon Chaplin  <damon at gnome.org>

	    * src/goocanvasitemsimple.c: made "stroke-color-rgba" and
	    "fill-color-rgba" properties read/write.

	    * configure.in (pkg_modules): depend on cairo >= 1.4.0 for
	    cairo_pattern_get_rgba().

	    * demo/demo.c (test_color_properties): added some test code.



Index: demo.c
===================================================================
RCS file: /cvs/cairo/goocanvas/demo/demo.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- demo.c	25 Feb 2008 14:12:25 -0000	1.31
+++ demo.c	23 Mar 2008 23:33:42 -0000	1.32
@@ -1319,6 +1319,40 @@
 }
 
 
+/* This checks that the rgba color properties work properly, i.e. the value
+   written to them is the same when read back out. */
+static void
+test_color_properties (GooCanvasItem *root)
+{
+#if 0
+  GooCanvasItem *item;
+  guint red, green, blue, alpha, rgba_in, rgba_out;
+
+  item = goo_canvas_rect_new (root, 20, 30, 50, 30,
+			      NULL);
+
+  for (red = 0; red < 256; red += 15)
+    {
+      for (green = 0; green < 256; green += 15)
+	{     
+	  for (blue = 0; blue < 256; blue ++)
+	    {     
+	      for (alpha = 0; alpha < 256; alpha += 15)
+		{     
+		  rgba_in = (red << 24) + (green << 16) + (blue << 8) + alpha;
+		  g_object_set (item, "fill_color_rgba", rgba_in, NULL);
+		  rgba_out = 0;
+		  g_object_get (item, "fill_color_rgba", &rgba_out, NULL);
+
+		  if (rgba_in != rgba_out)
+		    g_print ("ERROR: rgba in: %.8X out: %.8X\n", rgba_in, rgba_out);
+		}
+	    }
+	}
+    }
+#endif
+}
+
 static void
 setup_canvas (GooCanvas *canvas)
 {
@@ -1339,6 +1373,8 @@
   setup_images (root);
   setup_invisible_texts (root);
 #endif
+
+  test_color_properties (root);
 }
 
 



More information about the cairo-commit mailing list