[monet/monet-xml] mn-config: add support for stroke-gradient element



commit 58a260850f37ef3c5ff2b6bee3ac3779273e68e2
Author: Thomas Wood <thomas wood intel com>
Date:   Sun Jun 13 16:39:10 2010 +0100

    mn-config: add support for stroke-gradient element

 monet-gtk/monet.xml |    7 ++++++-
 monet/mn-config.c   |    9 +++++++--
 2 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/monet-gtk/monet.xml b/monet-gtk/monet.xml
index 5f23fdc..e79b060 100644
--- a/monet-gtk/monet.xml
+++ b/monet-gtk/monet.xml
@@ -34,7 +34,12 @@
 </widget>
 
 <widget type="check">
-  <rect x="0" y="0" width="-2" height="-2" stroke="#000" stroke-width="1"/>
+  <rect x="0" y="0" width="w-2" height="h-2" stroke="#000" stroke-width="1">
+    <stroke-gradient x1="0" y1="0" x2="0" y2="20">
+      <stop color="#fff" position="0"/>
+      <stop color="#000" position="1"/>
+    </stroke-gradient>
+  </rect>
 </widget>
 
 </monet>
diff --git a/monet/mn-config.c b/monet/mn-config.c
index a4eb76d..b33e5d7 100644
--- a/monet/mn-config.c
+++ b/monet/mn-config.c
@@ -190,7 +190,8 @@ widget_start_element (GMarkupParseContext  *context,
   int i;
 
   /* check for gradient defition */
-  if (!strcmp (element_name, "gradient"))
+  if (!strcmp (element_name, "gradient")
+      || !strcmp (element_name, "stroke-gradient"))
     {
       MnDrawingOp *op = state.op;
       cairo_pattern_t *gradient;
@@ -217,8 +218,12 @@ widget_start_element (GMarkupParseContext  *context,
 
       gradient = cairo_pattern_create_linear (x_1, y_1, x_2, y_2);
 
+      if (!strcmp (element_name, "stroke-gradient"))
+        op->stroke = gradient;
+      else
+        op->fill = gradient;
+
       state.gradient = gradient;
-      op->fill = gradient;
     }
   else if (!strcmp (element_name, "stop"))
     {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]