gegl r1997 - in trunk: . operations/meta



Author: kcozens
Date: Mon Feb 11 01:20:51 2008
New Revision: 1997
URL: http://svn.gnome.org/viewvc/gegl?rev=1997&view=rev

Log:
* operations/meta/dropshadow.c:
* operations/meta/tonemap.c:
* operations/meta/unsharp-mask.c: Updated to new chanting API.


Modified:
   trunk/ChangeLog
   trunk/operations/meta/dropshadow.c
   trunk/operations/meta/layer.c
   trunk/operations/meta/tonemap.c
   trunk/operations/meta/unsharp-mask.c

Modified: trunk/operations/meta/dropshadow.c
==============================================================================
--- trunk/operations/meta/dropshadow.c	(original)
+++ trunk/operations/meta/dropshadow.c	Mon Feb 11 01:20:51 2008
@@ -15,25 +15,22 @@
  *
  * Copyright 2006 Ãyvind KolÃs <pippin gimp org>
  */
-#if GEGL_CHANT_PROPERTIES
+#ifdef GEGL_CHANT_PROPERTIES
 
-gegl_chant_double (opacity, -10.0, 10.0, 0.5, "Opacity")
-gegl_chant_double (x, -G_MAXDOUBLE, G_MAXDOUBLE, 20.0,
+gegl_chant_double (opacity, "Opacity", -10.0, 10.0, 0.5, "Opacity")
+gegl_chant_double (x, "X", -G_MAXDOUBLE, G_MAXDOUBLE, 20.0,
                    "Horizontal shadow offset.")
-gegl_chant_double (y, -G_MAXDOUBLE, G_MAXDOUBLE, 20.0,
+gegl_chant_double (y, "Y", -G_MAXDOUBLE, G_MAXDOUBLE, 20.0,
                    "Vertical shadow offset.")
-gegl_chant_double (radius, -G_MAXDOUBLE, G_MAXDOUBLE, 10.0,
+gegl_chant_double (radius, "Radius", -G_MAXDOUBLE, G_MAXDOUBLE, 10.0,
                    "Blur radius.")
 
 #else
 
-#define GEGL_CHANT_META
-#define GEGL_CHANT_NAME            dropshadow
-#define GEGL_CHANT_DESCRIPTION     "Creates a dropshadow effect on the input buffer."
-#define GEGL_CHANT_SELF            "dropshadow.c"
-#define GEGL_CHANT_CATEGORIES      "meta:effects"
-#define GEGL_CHANT_CLASS_INIT
-#include "gegl-old-chant.h"
+#define GEGL_CHANT_TYPE_META
+#define GEGL_CHANT_C_FILE       "dropshadow.c"
+
+#include "gegl-chant.h"
 
 typedef struct _Priv Priv;
 struct _Priv
@@ -53,14 +50,14 @@
 /* in attach we hook into graph adding the needed nodes */
 static void attach (GeglOperation *operation)
 {
-  GeglChantOperation *self = GEGL_CHANT_OPERATION (operation);
-  Priv *priv = (Priv*)self->priv;
+  GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+  Priv *priv = (Priv*)o->chant_data;
   g_assert (priv == NULL);
 
   priv = g_malloc0 (sizeof (Priv));
-  self->priv = (void*) priv;
+  o->chant_data = (void*) priv;
 
-  priv->self = GEGL_OPERATION (self)->node;
+  priv->self = operation->node;
 
   if (!priv->over)
     {
@@ -88,9 +85,21 @@
     }
 }
 
-static void class_init (GeglOperationClass *klass)
+
+static void
+operation_class_init (GeglChantClass *klass)
 {
-  klass->attach = attach;
+  GObjectClass       *object_class;
+  GeglOperationClass *operation_class;
+
+  object_class    = G_OBJECT_CLASS (klass);
+  operation_class = GEGL_OPERATION_CLASS (klass);
+  operation_class->attach = attach;
+
+  operation_class->name        = "dropshadow";
+  operation_class->categories  = "meta:effects";
+  operation_class->description =
+        "Creates a dropshadow effect on the input buffer.";
 }
 
 #endif

Modified: trunk/operations/meta/layer.c
==============================================================================
--- trunk/operations/meta/layer.c	(original)
+++ trunk/operations/meta/layer.c	Mon Feb 11 01:20:51 2008
@@ -40,22 +40,23 @@
 {
   GeglOperationMeta parent_instance;
   gpointer          properties;
+
   GeglNode *self;
   GeglNode *input;
   GeglNode *aux;
   GeglNode *output;
 
   GeglNode *composite_op;
-    GeglNode *shift;
-    GeglNode *opacity;
-    GeglNode *load;
+  GeglNode *shift;
+  GeglNode *opacity;
+  GeglNode *load;
 
-    gchar *cached_path;
+  gchar *cached_path;
 
   gdouble p_opacity;
   gdouble p_x;
   gdouble p_y;
-  gchar *p_composite_op;
+  gchar  *p_composite_op;
 };
 
 typedef struct

Modified: trunk/operations/meta/tonemap.c
==============================================================================
--- trunk/operations/meta/tonemap.c	(original)
+++ trunk/operations/meta/tonemap.c	Mon Feb 11 01:20:51 2008
@@ -15,21 +15,18 @@
  *
  * Copyright 2006 Ãyvind KolÃs <pippin gimp org>
  */
-#if GEGL_CHANT_PROPERTIES
+#ifdef GEGL_CHANT_PROPERTIES
 
-gegl_chant_double(radius, 0.0, 100.0, 20.0, "radius")
-gegl_chant_double(blur, 0.0, 100.0,   15.0,   "blur")
-gegl_chant_double(amount, -1.0, 2.0, 0.5, "amount")
+gegl_chant_double(radius, "Radius", 0.0, 100.0, 20.0, "radius")
+gegl_chant_double(blur, "Blur", 0.0, 100.0,   15.0,   "blur")
+gegl_chant_double(amount, "Amount", -1.0, 2.0, 0.5, "amount")
 
 #else
 
-#define GEGL_CHANT_META
-#define GEGL_CHANT_NAME            tonemap
-#define GEGL_CHANT_DESCRIPTION     "local contrast enhancement"
-#define GEGL_CHANT_SELF            "tonemap.c"
-#define GEGL_CHANT_CATEGORIES      "meta:enhance"
-#define GEGL_CHANT_CLASS_INIT
-#include "gegl-old-chant.h"
+#define GEGL_CHANT_TYPE_META
+#define GEGL_CHANT_C_FILE       "tonemap.c"
+
+#include "gegl-chant.h"
 
 typedef struct _Priv Priv;
 struct _Priv
@@ -49,13 +46,12 @@
 
 static void attach (GeglOperation *operation)
 {
-  GeglChantOperation *self;
-  Priv          *priv;
-
-  self       = GEGL_CHANT_OPERATION (operation);
-  priv       = g_malloc0 (sizeof (Priv));
-  self->priv = (void*) priv;
+  GeglChantO *o;
+  Priv       *priv;
 
+  o    = GEGL_CHANT_PROPERTIES (operation);
+  priv = g_malloc0 (sizeof (Priv));
+  o->chant_data = (void*) priv;
 
   if (!priv->min)
     {
@@ -118,9 +114,20 @@
     }
 }
 
-static void class_init (GeglOperationClass *klass)
+
+static void
+operation_class_init (GeglChantClass *klass)
 {
-  klass->attach = attach;
+  GObjectClass       *object_class;
+  GeglOperationClass *operation_class;
+
+  object_class    = G_OBJECT_CLASS (klass);
+  operation_class = GEGL_OPERATION_CLASS (klass);
+  operation_class->attach = attach;
+
+  operation_class->name        = "tonemap";
+  operation_class->categories  = "meta:enhance";
+  operation_class->description = "Local contrast enhancement";
 }
 
 #endif

Modified: trunk/operations/meta/unsharp-mask.c
==============================================================================
--- trunk/operations/meta/unsharp-mask.c	(original)
+++ trunk/operations/meta/unsharp-mask.c	Mon Feb 11 01:20:51 2008
@@ -15,20 +15,17 @@
  *
  * Copyright 2006 Ãyvind KolÃs <pippin gimp org>
  */
-#if GEGL_CHANT_PROPERTIES
+#ifdef GEGL_CHANT_PROPERTIES
 
-gegl_chant_double(std_dev, 0.0, 100.0, 1.0, "Standard deviation (spatial scale factor)")
-gegl_chant_double(scale,  0.0, 100.0, 1.0, "Scale, strength of effect.")
+gegl_chant_double(std_dev, "Std. Dev.", 0.0, 100.0, 1.0, "Standard deviation (spatial scale factor)")
+gegl_chant_double(scale,  "Scale", 0.0, 100.0, 1.0, "Scale, strength of effect.")
 
 #else
 
-#define GEGL_CHANT_META
-#define GEGL_CHANT_NAME            unsharp_mask
-#define GEGL_CHANT_DESCRIPTION     "Performs an unsharp mask on the input buffer (sharpens an image by adding false mach-bands around edges)."
-#define GEGL_CHANT_SELF            "unsharp-mask.c"
-#define GEGL_CHANT_CATEGORIES      "meta:enhance"
-#define GEGL_CHANT_CLASS_INIT
-#include "gegl-old-chant.h"
+#define GEGL_CHANT_TYPE_META
+#define GEGL_CHANT_C_FILE       "unsharp-mask.c"
+
+#include "gegl-chant.h"
 
 typedef struct _Priv Priv;
 struct _Priv
@@ -45,17 +42,14 @@
 
 static void attach (GeglOperation *operation)
 {
-  GeglChantOperation *self;
-  Priv          *priv;
-
-  self       = GEGL_CHANT_OPERATION (operation);
-  priv       = g_malloc0 (sizeof (Priv));
-  self->priv = (void*) priv;
+  GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+  Priv       *priv = g_malloc0 (sizeof (Priv));
 
+  o->chant_data = (void*) priv;
 
   if (!priv->add)
     {
-      GeglNode      *gegl;
+      GeglNode *gegl;
       gegl = operation->node;
 
       priv->input    = gegl_node_get_input_proxy (gegl, "input");
@@ -80,7 +74,6 @@
       gegl_node_link (priv->input, priv->blur);
       gegl_node_link_many (priv->input, priv->add, priv->output, NULL);
 
-
       gegl_node_connect_from (priv->subtract, "aux",   priv->blur,     "output");
       gegl_node_connect_from (priv->add,      "aux",   priv->multiply, "output");
 
@@ -90,9 +83,22 @@
     }
 }
 
-static void class_init (GeglOperationClass *klass)
+
+static void
+operation_class_init (GeglChantClass *klass)
 {
-  klass->attach = attach;
+  GObjectClass       *object_class;
+  GeglOperationClass *operation_class;
+
+  object_class    = G_OBJECT_CLASS (klass);
+  operation_class = GEGL_OPERATION_CLASS (klass);
+  operation_class->attach = attach;
+
+  operation_class->name        = "unsharp-mask";
+  operation_class->categories  = "meta:enhance";
+  operation_class->description =
+        "Performs an unsharp mask on the input buffer (sharpens an image by"
+        " adding false mach-bands around edges).";
 }
 
 #endif



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