gegl r2667 - in trunk: . gegl operations/external operations/workshop



Author: ok
Date: Thu Oct 30 10:44:58 2008
New Revision: 2667
URL: http://svn.gnome.org/viewvc/gegl?rev=2667&view=rev

Log:
* gegl/gegl-chant.h: changed the path change singaling behavior,
ops having a GeglPath property now needs to have a path_changed
function within the compilation unit, that will be invoked when
the path property changes.
* operations/external/fill.c: (path_changed): changed ..
* operations/workshop/stroke.c: (path_changed): .. accordingly.


Modified:
   trunk/ChangeLog
   trunk/gegl/gegl-chant.h
   trunk/operations/external/fill.c
   trunk/operations/workshop/stroke.c

Modified: trunk/gegl/gegl-chant.h
==============================================================================
--- trunk/gegl/gegl-chant.h	(original)
+++ trunk/gegl/gegl-chant.h	Thu Oct 30 10:44:58 2008
@@ -354,7 +354,8 @@
 #define gegl_chant_pointer(name, nick, blurb)                gpointer    name;
 #define gegl_chant_color(name, nick, def, blurb)             GeglColor  *name;
 #define gegl_chant_curve(name, nick, blurb)                  GeglCurve  *name;
-#define gegl_chant_path(name, nick, blurb)                   GeglPath   *name;
+#define gegl_chant_path(name, nick, blurb)                   GeglPath   *name;\
+                                                   guint path_changed_handler;
 
 #include GEGL_CHANT_C_FILE
 
@@ -548,15 +549,18 @@
 #define gegl_chant_path(name, nick, blurb)                            \
     case PROP_##name:                                                 \
       if (properties->name != NULL)                                   \
-        {/*XXX: remove old signal */                                  \
+        {\
+          if (properties->path_changed_handler) \
+            g_signal_handler_disconnect (G_OBJECT (properties->name), properties->path_changed_handler);\
+         properties->path_changed_handler = 0;\
          g_object_unref (properties->name);                           \
         }                                                             \
       properties->name = NULL;                                        \
       if (g_value_peek_pointer (value))                               \
         {                                                             \
           properties->name = g_value_dup_object (value);              \
-          g_signal_connect (G_OBJECT (properties->name), "changed",   \
-          G_CALLBACK(gegl_operation_path_prop_changed), gobject);     \
+          properties->path_changed_handler = g_signal_connect (G_OBJECT (properties->name), "changed",   \
+          G_CALLBACK(path_changed), gobject);     \
          }
       break; /*XXX*/
 

Modified: trunk/operations/external/fill.c
==============================================================================
--- trunk/operations/external/fill.c	(original)
+++ trunk/operations/external/fill.c	Thu Oct 30 10:44:58 2008
@@ -38,6 +38,11 @@
 #include "gegl-plugin.h"
 #include "property-types/gegl-path.h"
 
+
+static void path_changed (GeglPath *path,
+                          const GeglRectangle *roi,
+                          gpointer userdata);
+
 #include "gegl-chant.h"
 #include <cairo/cairo.h>
 
@@ -47,6 +52,15 @@
   gegl_operation_set_format (operation, "output", babl_format ("B'aG'aR'aA u8"));
 }
 
+
+static void path_changed (GeglPath *path,
+                          const GeglRectangle *roi,
+                          gpointer userdata)
+{
+  /* invalidate the incoming rectangle */
+  gegl_operation_invalidate (userdata, roi);
+};
+
 static GeglRectangle
 get_bounding_box (GeglOperation *operation)
 {

Modified: trunk/operations/workshop/stroke.c
==============================================================================
--- trunk/operations/workshop/stroke.c	(original)
+++ trunk/operations/workshop/stroke.c	Thu Oct 30 10:44:58 2008
@@ -25,7 +25,7 @@
 
 gegl_chant_path   (path,   _("Vector"),
                              _("A GeglVector representing the path of the stroke"))
-gegl_chant_color  (color,    _("Color"),      "rgba(0.1,0.2,0.3,1.0)",
+gegl_chant_color  (color,    _("Color"),      "rgba(0.1,0.2,0.3,0.1)",
                              _("Color of paint to use"))
 gegl_chant_double (linewidth,_("Linewidth"),  0.0, 100.0, 3.0,
                              _("width of stroke"))
@@ -41,9 +41,29 @@
 
 /* the path api isn't public yet */
 #include "property-types/gegl-path.h"
+static void path_changed (GeglPath *path,
+                          const GeglRectangle *roi,
+                          gpointer userdata);
 
 #include "gegl-chant.h"
 
+
+static void path_changed (GeglPath *path,
+                          const GeglRectangle *roi,
+                          gpointer userdata)
+{
+  GeglRectangle rect = *roi;
+  GeglChantO    *o   = GEGL_CHANT_PROPERTIES (userdata);
+  /* invalidate the incoming rectangle */
+
+  rect.x -= o->linewidth/2;
+  rect.y -= o->linewidth/2;
+  rect.width += o->linewidth;
+  rect.height += o->linewidth;
+
+  gegl_operation_invalidate (userdata, &rect);
+};
+
 static void
 prepare (GeglOperation *operation)
 {



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