gegl r1918 - in trunk: . operations/blur operations/color operations/core operations/io



Author: kcozens
Date: Sun Jan 27 23:40:17 2008
New Revision: 1918
URL: http://svn.gnome.org/viewvc/gegl?rev=1918&view=rev

Log:
	* operations/core/clone.c:
	* operations/core/convert-format.c:
	* operations/core/crop.c:
	* operations/core/shift.c:
	* operations/io/jpg-load.c:
	* operations/io/pixbuf.c:
	* operations/io/png-load.c:
	* operations/io/png-save.c:
	* operations/io/save-buffer.c:
	* operations/io/save-pixbuf.c:
	* operations/io/svg-load.c: Updated to new chanting API.

	* operations/blur/box-blur.c:
	* operations/blur/gaussian-blur.c:
	* operations/color/brightness-contrast.c
	* operations/color/invert.c
	* operations/color/mono-mixer.c
	* operations/color/stretch-contrast.c
	* operations/core/nop.c: Formatting changes.


Modified:
   trunk/ChangeLog
   trunk/operations/blur/box-blur.c
   trunk/operations/blur/gaussian-blur.c
   trunk/operations/color/brightness-contrast.c
   trunk/operations/color/invert.c
   trunk/operations/color/mono-mixer.c
   trunk/operations/color/stretch-contrast.c
   trunk/operations/core/clone.c
   trunk/operations/core/convert-format.c
   trunk/operations/core/crop.c
   trunk/operations/core/nop.c
   trunk/operations/core/shift.c
   trunk/operations/io/jpg-load.c
   trunk/operations/io/pixbuf.c
   trunk/operations/io/png-load.c
   trunk/operations/io/png-save.c
   trunk/operations/io/save-buffer.c
   trunk/operations/io/save-pixbuf.c
   trunk/operations/io/svg-load.c

Modified: trunk/operations/blur/box-blur.c
==============================================================================
--- trunk/operations/blur/box-blur.c	(original)
+++ trunk/operations/blur/box-blur.c	Sun Jan 27 23:40:17 2008
@@ -22,9 +22,11 @@
 #else
 
 #define GEGL_CHANT_TYPE_AREA_FILTER
-#define GEGL_CHANT_C_FILE          "box-blur.c"
+#define GEGL_CHANT_C_FILE       "box-blur.c"
 
 #include "gegl-chant.h"
+#include <stdio.h>
+#include <math.h>
 
 static void hor_blur (GeglBuffer *src,
                       GeglBuffer *dst,
@@ -34,42 +36,6 @@
                       GeglBuffer *dst,
                       gint        radius);
 
-#include <stdio.h>
-#include <math.h>
-
-static void prepare (GeglOperation *operation)
-{
-  GeglChantO              *o;
-  GeglOperationAreaFilter *op_area;
-
-  op_area = GEGL_OPERATION_AREA_FILTER (operation);
-  o       = GEGL_CHANT_PROPERTIES (operation);
-
-  op_area->left   =
-  op_area->right  =
-  op_area->top    =
-  op_area->bottom = ceil (o->radius);
-}
-
-static gboolean
-process (GeglOperation       *operation,
-         GeglBuffer          *input,
-         GeglBuffer          *output,
-         const GeglRectangle *result)
-{
-  GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
-  GeglBuffer *temp;
-
-  temp  = gegl_buffer_new (gegl_buffer_get_extent (input),
-                           babl_format ("RaGaBaA float"));
-
-  hor_blur (input, temp,  o->radius);
-  ver_blur (temp, output, o->radius);
-
-  g_object_unref (temp);
-  return  TRUE;
-}
-
 #ifdef USE_DEAD_CODE
 static inline float
 get_mean_component (gfloat *buf,
@@ -238,7 +204,38 @@
   g_free (dst_buf);
 }
 
-#include <math.h>
+static void prepare (GeglOperation *operation)
+{
+  GeglChantO              *o;
+  GeglOperationAreaFilter *op_area;
+
+  op_area = GEGL_OPERATION_AREA_FILTER (operation);
+  o       = GEGL_CHANT_PROPERTIES (operation);
+
+  op_area->left   =
+  op_area->right  =
+  op_area->top    =
+  op_area->bottom = ceil (o->radius);
+}
+
+static gboolean
+process (GeglOperation       *operation,
+         GeglBuffer          *input,
+         GeglBuffer          *output,
+         const GeglRectangle *result)
+{
+  GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+  GeglBuffer *temp;
+
+  temp  = gegl_buffer_new (gegl_buffer_get_extent (input),
+                           babl_format ("RaGaBaA float"));
+
+  hor_blur (input, temp,  o->radius);
+  ver_blur (temp, output, o->radius);
+
+  g_object_unref (temp);
+  return  TRUE;
+}
 
 
 static void
@@ -247,14 +244,14 @@
   GeglOperationClass       *operation_class;
   GeglOperationFilterClass *filter_class;
 
-  operation_class  = GEGL_OPERATION_CLASS (klass);
-  filter_class     = GEGL_OPERATION_FILTER_CLASS (klass);
+  operation_class = GEGL_OPERATION_CLASS (klass);
+  filter_class    = GEGL_OPERATION_FILTER_CLASS (klass);
 
-  filter_class->process   = process;
+  filter_class->process    = process;
   operation_class->prepare = prepare;
 
-  operation_class->categories = "blur";
-  operation_class->name       = "box-blur";
+  operation_class->categories  = "blur";
+  operation_class->name        = "box-blur";
   operation_class->description =
        "Performs an averaging of a square box of pixels.";
 }

Modified: trunk/operations/blur/gaussian-blur.c
==============================================================================
--- trunk/operations/blur/gaussian-blur.c	(original)
+++ trunk/operations/blur/gaussian-blur.c	Sun Jan 27 23:40:17 2008
@@ -34,8 +34,8 @@
 
 #define GEGL_CHANT_TYPE_AREA_FILTER
 #define GEGL_CHANT_C_FILE       "gaussian-blur.c"
-#include "gegl-chant.h"
 
+#include "gegl-chant.h"
 #include <math.h>
 #include <stdio.h>
 
@@ -78,64 +78,6 @@
               gint        offsetY);
 
 
-static void prepare (GeglOperation *operation)
-{
-  GeglOperationAreaFilter *area = GEGL_OPERATION_AREA_FILTER (operation);
-  GeglChantO              *o    = GEGL_CHANT_PROPERTIES (operation);
-  area->left = area->right = ceil (o->std_dev_x * RADIUS_SCALE);
-  area->top = area->bottom = ceil (o->std_dev_y * RADIUS_SCALE);
-}
-
-static gboolean
-process (GeglOperation       *operation,
-         GeglBuffer          *input,
-         GeglBuffer          *output,
-         const GeglRectangle *result)
-{
-  GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
-  GeglBuffer *temp;
-  gdouble     B, b[4];
-  gdouble    *cmatrix;
-  gint        cmatrix_len;
-
-  temp  = gegl_buffer_new (gegl_buffer_get_extent (input),
-                           babl_format ("RaGaBaA float"));
-
-  gboolean force_iir = o->filter && !strcmp (o->filter, "iir");
-  gboolean force_fir = o->filter && !strcmp (o->filter, "fir");
-
-  if ((force_iir || o->std_dev_x > 1.0) && !force_fir)
-    {
-      iir_young_find_constants (o->std_dev_x, &B, b);
-      iir_young_hor_blur (input, temp,   B, b);
-    }
-  else
-    {
-      cmatrix_len =
-          fir_gen_convolve_matrix (o->std_dev_x, &cmatrix);
-      fir_hor_blur (input, temp, cmatrix, cmatrix_len);
-      g_free (cmatrix);
-    }
-  if ((force_iir || o->std_dev_y > 1.0) && !force_fir)
-    {
-      iir_young_find_constants (o->std_dev_y, &B, b);
-      iir_young_ver_blur (temp, output, B, b,
-                          o->std_dev_x * RADIUS_SCALE);
-    }
-  else
-    {
-      cmatrix_len =
-          fir_gen_convolve_matrix (o->std_dev_y, &cmatrix);
-      fir_ver_blur (temp, output, cmatrix, cmatrix_len,
-       o->std_dev_x * RADIUS_SCALE,
-       o->std_dev_y * RADIUS_SCALE);
-      g_free (cmatrix);
-    }
-
-  g_object_unref (temp);
-  return  TRUE;
-}
-
 static void
 iir_young_find_constants (gfloat   sigma,
                           gdouble *B,
@@ -451,7 +393,63 @@
   g_free (dst_buf);
 }
 
-#include <math.h>
+static void prepare (GeglOperation *operation)
+{
+  GeglOperationAreaFilter *area = GEGL_OPERATION_AREA_FILTER (operation);
+  GeglChantO              *o    = GEGL_CHANT_PROPERTIES (operation);
+  area->left = area->right = ceil (o->std_dev_x * RADIUS_SCALE);
+  area->top = area->bottom = ceil (o->std_dev_y * RADIUS_SCALE);
+}
+
+static gboolean
+process (GeglOperation       *operation,
+         GeglBuffer          *input,
+         GeglBuffer          *output,
+         const GeglRectangle *result)
+{
+  GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+  GeglBuffer *temp;
+  gdouble     B, b[4];
+  gdouble    *cmatrix;
+  gint        cmatrix_len;
+
+  temp  = gegl_buffer_new (gegl_buffer_get_extent (input),
+                           babl_format ("RaGaBaA float"));
+
+  gboolean force_iir = o->filter && !strcmp (o->filter, "iir");
+  gboolean force_fir = o->filter && !strcmp (o->filter, "fir");
+
+  if ((force_iir || o->std_dev_x > 1.0) && !force_fir)
+    {
+      iir_young_find_constants (o->std_dev_x, &B, b);
+      iir_young_hor_blur (input, temp,   B, b);
+    }
+  else
+    {
+      cmatrix_len =
+          fir_gen_convolve_matrix (o->std_dev_x, &cmatrix);
+      fir_hor_blur (input, temp, cmatrix, cmatrix_len);
+      g_free (cmatrix);
+    }
+  if ((force_iir || o->std_dev_y > 1.0) && !force_fir)
+    {
+      iir_young_find_constants (o->std_dev_y, &B, b);
+      iir_young_ver_blur (temp, output, B, b,
+                          o->std_dev_x * RADIUS_SCALE);
+    }
+  else
+    {
+      cmatrix_len =
+          fir_gen_convolve_matrix (o->std_dev_y, &cmatrix);
+      fir_ver_blur (temp, output, cmatrix, cmatrix_len,
+       o->std_dev_x * RADIUS_SCALE,
+       o->std_dev_y * RADIUS_SCALE);
+      g_free (cmatrix);
+    }
+
+  g_object_unref (temp);
+  return  TRUE;
+}
 
 
 static void
@@ -460,14 +458,14 @@
   GeglOperationClass       *operation_class;
   GeglOperationFilterClass *filter_class;
 
-  operation_class  = GEGL_OPERATION_CLASS (klass);
-  filter_class     = GEGL_OPERATION_FILTER_CLASS (klass);
+  operation_class = GEGL_OPERATION_CLASS (klass);
+  filter_class    = GEGL_OPERATION_FILTER_CLASS (klass);
 
-  filter_class->process   = process;
+  filter_class->process    = process;
   operation_class->prepare = prepare;
 
-  operation_class->categories = "blur";
-  operation_class->name       = "gaussian-blur";
+  operation_class->categories  = "blur";
+  operation_class->name        = "gaussian-blur";
   operation_class->description =
         "Performs an averaging of neighbouring pixels with the normal distribution as weighting.";
 }

Modified: trunk/operations/color/brightness-contrast.c
==============================================================================
--- trunk/operations/color/brightness-contrast.c	(original)
+++ trunk/operations/color/brightness-contrast.c	Sun Jan 27 23:40:17 2008
@@ -50,6 +50,13 @@
  */
 #include "gegl-chant.h"
 
+static void prepare (GeglOperation *operation)
+{
+  /* set the babl format this operation prefers to work on */
+  gegl_operation_set_format (operation, "input", babl_format ("RGBA float"));
+  gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
+}
+
 /* GeglOperationPointFilter gives us a linear buffer to operate on
  * in our requested pixel format
  */
@@ -80,13 +87,6 @@
 }
 
 
-static void prepare (GeglOperation *operation)
-{
-  /* set the babl format this operation prefers to work on */
-  gegl_operation_set_format (operation, "input", babl_format ("RGBA float"));
-  gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
-}
-
 static void
 operation_class_init (GeglChantClass *klass)
 {

Modified: trunk/operations/color/invert.c
==============================================================================
--- trunk/operations/color/invert.c	(original)
+++ trunk/operations/color/invert.c	Sun Jan 27 23:40:17 2008
@@ -64,11 +64,11 @@
 
   point_filter_class->process = process;
 
-  operation_class->name       = "invert";
-  operation_class->categories = "color";
+  operation_class->name        = "invert";
+  operation_class->categories  = "color";
   operation_class->description =
-     "Inverts the components (except alpha), the result is the "
-     "corresponding \"negative\" image.";
+     "Inverts the components (except alpha), the result is the"
+     " corresponding \"negative\" image.";
 }
 
 #endif

Modified: trunk/operations/color/mono-mixer.c
==============================================================================
--- trunk/operations/color/mono-mixer.c	(original)
+++ trunk/operations/color/mono-mixer.c	Sun Jan 27 23:40:17 2008
@@ -43,11 +43,9 @@
          const GeglRectangle *result)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
-
   gfloat      red   = o->red;
   gfloat      green = o->green;
   gfloat      blue  = o->blue;
-
   gfloat     *in_buf;
   gfloat     *out_buf;
 

Modified: trunk/operations/color/stretch-contrast.c
==============================================================================
--- trunk/operations/color/stretch-contrast.c	(original)
+++ trunk/operations/color/stretch-contrast.c	Sun Jan 27 23:40:17 2008
@@ -80,6 +80,15 @@
   gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
 }
 
+static GeglRectangle
+compute_input_request (GeglOperation       *operation,
+                       const gchar         *input_pad,
+                       const GeglRectangle *roi)
+{
+  GeglRectangle result = *gegl_operation_source_get_defined_region (operation, "input");
+  return result;
+}
+
 static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
@@ -117,17 +126,7 @@
   return TRUE;
 }
 
-static GeglRectangle
-compute_input_request (GeglOperation       *operation,
-                       const gchar         *input_pad,
-                       const GeglRectangle *roi)
-{
-  GeglRectangle result = *gegl_operation_source_get_defined_region (operation, "input");
-  return result;
-}
-
-/* This is called at the end of the gobject class_init function, the
- * GEGL_CHANT_CLASS_INIT was needed to make this happen
+/* This is called at the end of the gobject class_init function.
  *
  * Here we override the standard passthrough options for the rect
  * computations.
@@ -138,18 +137,19 @@
   GeglOperationClass       *operation_class;
   GeglOperationFilterClass *filter_class;
 
-  operation_class  = GEGL_OPERATION_CLASS (klass);
-  filter_class     = GEGL_OPERATION_FILTER_CLASS (klass);
+  operation_class = GEGL_OPERATION_CLASS (klass);
+  filter_class    = GEGL_OPERATION_FILTER_CLASS (klass);
 
   filter_class->process = process;
   operation_class->prepare = prepare;
+  operation_class->compute_input_request = compute_input_request;
 
-  operation_class->name       = "stretch-contrast";
-  operation_class->categories = "color:enhance";
+  operation_class->name        = "stretch-contrast";
+  operation_class->categories  = "color:enhance";
   operation_class->description =
-        "Scales the components of the buffer to be in the 0.0-1.0 range. This improves images that makes poor use of the available contrast (little contrast, very dark, or very bright images).";
-
-  operation_class->compute_input_request = compute_input_request;
+        "Scales the components of the buffer to be in the 0.0-1.0 range."
+        " This improves images that makes poor use of the available contrast"
+        " (little contrast, very dark, or very bright images).";
 }
 
 #endif

Modified: trunk/operations/core/clone.c
==============================================================================
--- trunk/operations/core/clone.c	(original)
+++ trunk/operations/core/clone.c	Sun Jan 27 23:40:17 2008
@@ -1,4 +1,4 @@
-/* This file is part of GEGL
+/* This file is an image processing operation for GEGL
  *
  * GEGL is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -13,199 +13,24 @@
  * You should have received a copy of the GNU Lesser General Public
  * License along with GEGL; if not, see <http://www.gnu.org/licenses/>.
  *
- * Copyright 2006 Ãyvind KolÃs
+ * Copyright 2006 Ãyvind KolÃs <pippin gimp org>
  */
 
-#ifndef __GEGL_OPERATION_CLONE_H__
-#define __GEGL_OPERATION_CLONE_H__
+#ifdef GEGL_CHANT_PROPERTIES
 
-#include <gegl-plugin.h>
+gegl_chant_string (ref, "ID", "The reference ID used as input (for use in XML).")
 
-G_BEGIN_DECLS
+#else
 
-#define GEGL_TYPE_OPERATION_CLONE            (gegl_operation_clone_get_type ())
-#define GEGL_OPERATION_CLONE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEGL_TYPE_OPERATION_CLONE, GeglOperationClone))
-#define GEGL_OPERATION_CLONE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  GEGL_TYPE_OPERATION_CLONE, GeglOperationCloneClass))
-#define GEGL_IS_OPERATION_CLONE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEGL_TYPE_OPERATION_CLONE))
-#define GEGL_IS_OPERATION_CLONE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  GEGL_TYPE_OPERATION_CLONE))
-#define GEGL_OPERATION_CLONE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  GEGL_TYPE_OPERATION_CLONE, GeglOperationCloneClass))
+#define GEGL_CHANT_TYPE_FILTER
+#define GEGL_CHANT_C_FILE       "clone.c"
 
-typedef struct _GeglOperationClone      GeglOperationClone;
-typedef struct _GeglOperationCloneClass GeglOperationCloneClass;
-
-struct _GeglOperationClone
-{
-  GeglOperation parent_instance;
-  gchar *ref;
-};
-
-struct _GeglOperationCloneClass
-{
-  GeglOperationClass parent_class;
-};
-
-GType gegl_operation_clone_get_type (void) G_GNUC_CONST;
-
-G_END_DECLS
-
-#endif /* __GEGL_OPERATION_CLONE_H__ */
-
-/***************************************************************************/
-
-#include "graph/gegl-pad.h"
+#include "gegl-chant.h"
 #include "graph/gegl-node.h"
 #include <math.h>
 #include <string.h>
 
 
-enum
-{
-  PROP_0,
-  PROP_OUTPUT,
-  PROP_INPUT,
-  PROP_REF
-};
-
-static gboolean        process                 (GeglOperation       *operation,
-                                                GeglNodeContext     *context,
-                                                const gchar         *output_prop,
-                                                const GeglRectangle *result);
-static void            attach                  (GeglOperation       *operation);
-static GeglNode      * detect                  (GeglOperation       *operation,
-                                                gint                 x,
-                                                gint                 y);
-static GeglRectangle   get_defined_region      (GeglOperation       *operation);
-static GeglRectangle   compute_input_request   (GeglOperation       *operation,
-                                                const gchar         *input_pad,
-                                                const GeglRectangle *roi);
-static GeglRectangle   compute_affected_region (GeglOperation       *operation,
-                                                const gchar         *input_pad,
-                                                const GeglRectangle *input_region);
-static void            get_property            (GObject             *object,
-                                                guint                prop_id,
-                                                GValue              *value,
-                                                GParamSpec          *pspec);
-static void            set_property            (GObject             *object,
-                                                guint                prop_id,
-                                                const GValue        *value,
-                                                GParamSpec          *pspec);
-
-G_DEFINE_DYNAMIC_TYPE (GeglOperationClone, gegl_operation_clone, GEGL_TYPE_OPERATION)
-
-static void
-gegl_operation_clone_class_init (GeglOperationCloneClass *klass)
-{
-  GObjectClass       *object_class    = G_OBJECT_CLASS (klass);
-  GeglOperationClass *operation_class = GEGL_OPERATION_CLASS (klass);
-
-  object_class->get_property             = get_property;
-  object_class->set_property             = set_property;
-
-  operation_class->categories            = "core";
-  operation_class->no_cache              = TRUE;
-  operation_class->process               = process;
-  operation_class->attach                = attach;
-  operation_class->detect                = detect;
-  operation_class->get_defined_region    = get_defined_region;
-  operation_class->compute_input_request = compute_input_request;
-  operation_class->compute_affected_region = compute_affected_region;
-
-  gegl_operation_class_set_name (operation_class, "clone");
-
-
-  g_object_class_install_property (object_class, PROP_OUTPUT,
-                                   g_param_spec_object ("output",
-                                                        "Output",
-                                                        "Ouput pad for generated image buffer.",
-                                                        GEGL_TYPE_BUFFER,
-                                                        G_PARAM_READABLE |
-                                                        GEGL_PARAM_PAD_OUTPUT));
-
-  g_object_class_install_property (object_class, PROP_INPUT,
-                                   g_param_spec_object ("input",
-                                                        "Input",
-                                                        "Input pad, for image buffer input.",
-                                                        GEGL_TYPE_BUFFER,
-                                                        G_PARAM_READWRITE |
-                                                        GEGL_PARAM_PAD_INPUT));
-
-  g_object_class_install_property (object_class, PROP_REF,
-                                   g_param_spec_string ("ref",
-                                                        "Reference",
-                                                        "The reference ID used as input (for use in XML).",
-                                                        "",
-                                                        G_PARAM_READWRITE |
-                                                        GEGL_PARAM_PAD_INPUT));
-}
-
-static void
-gegl_operation_clone_class_finalize (GeglOperationCloneClass *klass)
-{
-}
-
-static void
-gegl_operation_clone_init (GeglOperationClone *self)
-{
-  self->ref = NULL;
-}
-
-static void
-get_property (GObject    *object,
-              guint       property_id,
-              GValue     *value,
-              GParamSpec *pspec)
-{
-  GeglOperationClone *self = GEGL_OPERATION_CLONE (object);
-
-  switch (property_id)
-    {
-    case PROP_REF:
-      g_value_set_string (value, self->ref);
-      break;
-
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-      break;
-    }
-}
-
-static void
-set_property (GObject      *object,
-              guint         property_id,
-              const GValue *value,
-              GParamSpec   *pspec)
-{
-  GeglOperationClone *self = GEGL_OPERATION_CLONE (object);
-
-  switch (property_id)
-    {
-    case PROP_REF:
-      if (self->ref)
-        g_free (self->ref);
-      self->ref = g_value_dup_string (value);
-      break;
-
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-      break;
-    }
-}
-
-
-static void
-attach (GeglOperation *operation)
-{
-  GObjectClass *object_class = G_OBJECT_GET_CLASS (operation);
-
-  gegl_operation_create_pad (operation,
-                             g_object_class_find_property (object_class,
-                                                           "output"));
-  gegl_operation_create_pad (operation,
-                             g_object_class_find_property (object_class,
-                                                           "input"));
-}
-
-
 static GeglNode *
 detect (GeglOperation *operation,
         gint           x,
@@ -213,16 +38,30 @@
 {
   GeglNode *node = operation->node;
 
-  if (x>=node->have_rect.x &&
-      y>=node->have_rect.y &&
-      x<node->have_rect.width  &&
-      y<node->have_rect.height )
+  if (x >= node->have_rect.x &&
+      y >= node->have_rect.y &&
+      x < node->have_rect.width &&
+      y < node->have_rect.height)
     {
       return node;
     }
   return NULL;
 }
 
+static GeglRectangle
+get_defined_region (GeglOperation *operation)
+{
+  GeglRectangle  result = { 0, 0, 0, 0 };
+  GeglRectangle *in_rect;
+
+  in_rect = gegl_operation_source_get_defined_region (operation, "input");
+  if (in_rect)
+    {
+      result = *in_rect;
+    }
+
+  return result;
+}
 
 static gboolean
 process (GeglOperation       *operation,
@@ -248,52 +87,22 @@
   return TRUE;
 }
 
-static GeglRectangle
-get_defined_region (GeglOperation *operation)
-{
-  GeglRectangle  result = { 0, 0, 0, 0 };
-  GeglRectangle *in_rect;
 
-  in_rect = gegl_operation_source_get_defined_region (operation, "input");
-  if (in_rect)
-    {
-      result = *in_rect;
-    }
-
-  return result;
-}
-
-static GeglRectangle
-compute_affected_region (GeglOperation       *operation,
-                         const gchar         *input_pad,
-                         const GeglRectangle *input_region)
+static void
+operation_class_init (GeglChantClass *klass)
 {
-  return *input_region;
-}
+  GeglOperationClass *operation_class;
 
-static GeglRectangle
-compute_input_request (GeglOperation       *operation,
-                       const gchar         *input_pad,
-                       const GeglRectangle *roi)
-{
-  return *roi;
-}
+  operation_class = GEGL_OPERATION_CLASS (klass);
+  operation_class->process = process;
+  operation_class->get_defined_region = get_defined_region;
+  operation_class->detect = detect;
 
-static const GeglModuleInfo modinfo =
-{
-  GEGL_MODULE_ABI_VERSION, "clone", "", ""
-};
+  operation_class->name        = "clone";
+  operation_class->categories  = "core";
+  operation_class->description = "Clone a buffer";
 
-G_MODULE_EXPORT const GeglModuleInfo *
-gegl_module_query (GTypeModule *module)
-{
-  return &modinfo;
+  operation_class->no_cache = TRUE;
 }
 
-G_MODULE_EXPORT gboolean
-gegl_module_register (GTypeModule *module)
-{
-  gegl_operation_clone_register_type (module);
-
-  return TRUE;
-}
+#endif

Modified: trunk/operations/core/convert-format.c
==============================================================================
--- trunk/operations/core/convert-format.c	(original)
+++ trunk/operations/core/convert-format.c	Sun Jan 27 23:40:17 2008
@@ -18,26 +18,25 @@
  *
  * This operation is just a forked grey op with format parameters.
  */
-#if GEGL_CHANT_PROPERTIES
+#ifdef GEGL_CHANT_PROPERTIES
+
 gegl_chant_string(format, "RGBA float", "Babl ouput format string")
-#else
 
-#define GEGL_CHANT_NAME          convert_format
-#define GEGL_CHANT_SELF          "convert-format.c"
-#define GEGL_CHANT_DESCRIPTION   "Convert the data into the specified format"
-#define GEGL_CHANT_CATEGORIES    "core:color"
+#else
 
-#define GEGL_CHANT_POINT_FILTER
-#define GEGL_CHANT_PREPARE
+#define GEGL_CHANT_TYPE_POINT_FILTER
+#define GEGL_CHANT_C_FILE       "convert-format.c"
 
-#include "gegl-old-chant.h"
+#include "gegl-chant.h"
 
 static void prepare (GeglOperation *operation)
 {
-  GeglChantOperation  *self = GEGL_CHANT_OPERATION (operation);
+  GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
   Babl *format;
-  g_assert (self->format);
-  format = babl_format (self->format);
+
+  g_assert (o->format);
+
+  format = babl_format (o->format);
   /* check format ? */
 
   gegl_operation_set_format (operation, "input", format);
@@ -48,9 +47,28 @@
 process (GeglOperation *op,
          void          *in_buf,
          void          *out_buf,
-         glong          samples) 
+         glong          samples)
 {
   return TRUE;
 }
 
+
+static void
+operation_class_init (GeglChantClass *klass)
+{
+  GeglOperationClass            *operation_class;
+  GeglOperationPointFilterClass *point_filter_class;
+
+  operation_class    = GEGL_OPERATION_CLASS (klass);
+  point_filter_class = GEGL_OPERATION_POINT_FILTER_CLASS (klass);
+
+  point_filter_class->process = process;
+  operation_class->prepare = prepare;
+
+  operation_class->name       = "convert-format";
+  operation_class->categories = "core:color";
+  operation_class->description =
+        "Convert the data to the specified format";
+}
+
 #endif

Modified: trunk/operations/core/crop.c
==============================================================================
--- trunk/operations/core/crop.c	(original)
+++ trunk/operations/core/crop.c	Sun Jan 27 23:40:17 2008
@@ -16,271 +16,79 @@
  * Copyright 2006 Ãyvind KolÃs
  */
 
-#ifndef __GEGL_OPERATION_CROP_H__
-#define __GEGL_OPERATION_CROP_H__
+#ifdef GEGL_CHANT_PROPERTIES
 
-#include <gegl-plugin.h>
+gegl_chant_double (x, -G_MAXFLOAT, G_MAXFLOAT, 0.0, "X")
+gegl_chant_double (y, -G_MAXFLOAT, G_MAXFLOAT, 0.0, "Y")
+gegl_chant_double (width,  -G_MAXFLOAT, G_MAXFLOAT, 10.0, "Width")
+gegl_chant_double (height, -G_MAXFLOAT, G_MAXFLOAT, 10.0, "Height")
 
-G_BEGIN_DECLS
+#else
 
-#define GEGL_TYPE_OPERATION_CROP            (gegl_operation_crop_get_type ())
-#define GEGL_OPERATION_CROP(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEGL_TYPE_OPERATION_CROP, GeglOperationCrop))
-#define GEGL_OPERATION_CROP_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  GEGL_TYPE_OPERATION_CROP, GeglOperationCropClass))
-#define GEGL_IS_OPERATION_CROP(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEGL_TYPE_OPERATION_CROP))
-#define GEGL_IS_OPERATION_CROP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  GEGL_TYPE_OPERATION_CROP))
-#define GEGL_OPERATION_CROP_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  GEGL_TYPE_OPERATION_CROP, GeglOperationCropClass))
+#define GEGL_CHANT_TYPE_FILTER
+#define GEGL_CHANT_C_FILE       "crop.c"
 
-typedef struct _GeglOperationCrop      GeglOperationCrop;
-typedef struct _GeglOperationCropClass GeglOperationCropClass;
-
-struct _GeglOperationCrop
-{
-  GeglOperation parent_instance;
-
-  gdouble       x;
-  gdouble       y;
-  gdouble       width;
-  gdouble       height;
-};
-
-struct _GeglOperationCropClass
-{
-  GeglOperationClass parent_class;
-};
-
-GType gegl_operation_crop_get_type (void) G_GNUC_CONST;
-
-G_END_DECLS
-
-#endif /* __GEGL_OPERATION_CROP_H__ */
-
-/***************************************************************************/
-
-#include "graph/gegl-pad.h"
+#include "gegl-chant.h"
 #include "graph/gegl-node.h"
 #include <math.h>
-#include <string.h>
-
-
-enum
-{
-  PROP_0,
-  PROP_OUTPUT,
-  PROP_INPUT,
-  PROP_X,
-  PROP_Y,
-  PROP_WIDTH,
-  PROP_HEIGHT
-};
-
-static void            get_property            (GObject             *object,
-                                                guint                prop_id,
-                                                GValue              *value,
-                                                GParamSpec          *pspec);
-static void            set_property            (GObject             *object,
-                                                guint                prop_id,
-                                                const GValue        *value,
-                                                GParamSpec          *pspec);
-
-static gboolean        process                 (GeglOperation       *operation,
-                                                GeglNodeContext     *context,
-                                                const gchar         *output_prop,
-                                                const GeglRectangle *result);
-static void            attach                  (GeglOperation       *operation);
-static GeglNode      * detect                  (GeglOperation       *operation,
-                                                gint                 x,
-                                                gint                 y);
-static GeglRectangle   get_defined_region      (GeglOperation       *operation);
-static GeglRectangle   compute_input_request   (GeglOperation       *operation,
-                                                const gchar         *input_pad,
-                                                const GeglRectangle *roi);
-static GeglRectangle   compute_affected_region (GeglOperation       *operation,
-                                                const gchar         *input_pad,
-                                                const GeglRectangle *input_region);
-
-G_DEFINE_DYNAMIC_TYPE (GeglOperationCrop, gegl_operation_crop,
-                       GEGL_TYPE_OPERATION)
-
-static void
-gegl_operation_crop_class_init (GeglOperationCropClass *klass)
-{
-  GObjectClass       *object_class    = G_OBJECT_CLASS (klass);
-  GeglOperationClass *operation_class = GEGL_OPERATION_CLASS (klass);
-
-  object_class->set_property             = set_property;
-  object_class->get_property             = get_property;
-
-  operation_class->categories            = "core";
-  operation_class->no_cache              = TRUE;
-  operation_class->process               = process;
-  operation_class->attach                = attach;
-  operation_class->detect                = detect;
-  operation_class->get_defined_region    = get_defined_region;
-  operation_class->compute_input_request = compute_input_request;
-  operation_class->compute_affected_region = compute_affected_region;
-
-  gegl_operation_class_set_name (operation_class, "crop");
-
-  g_object_class_install_property (object_class, PROP_OUTPUT,
-                                   g_param_spec_object ("output",
-                                                        "Output",
-                                                        "Ouput pad for generated image buffer.",
-                                                        GEGL_TYPE_BUFFER,
-                                                        G_PARAM_READABLE |
-                                                        GEGL_PARAM_PAD_OUTPUT));
-
-  g_object_class_install_property (object_class, PROP_INPUT,
-                                   g_param_spec_object ("input",
-                                                        "Input",
-                                                        "Input pad, for image buffer input.",
-                                                        GEGL_TYPE_BUFFER,
-                                                        G_PARAM_READWRITE |
-                                                        GEGL_PARAM_PAD_INPUT));
-
-  g_object_class_install_property (object_class, PROP_X,
-                                   g_param_spec_double ("x",
-                                                       "X",
-                                                       "X",
-                                                       -G_MAXFLOAT, G_MAXFLOAT,
-                                                       0.0,
-                                                       G_PARAM_READWRITE |
-                                                       G_PARAM_CONSTRUCT));
-
-  g_object_class_install_property (object_class, PROP_Y,
-                                   g_param_spec_double ("y",
-                                                       "Y",
-                                                       "Y",
-                                                       -G_MAXDOUBLE, G_MAXDOUBLE,
-                                                       0.0,
-                                                       G_PARAM_READWRITE |
-                                                       G_PARAM_CONSTRUCT));
-
-  g_object_class_install_property (object_class, PROP_WIDTH,
-                                   g_param_spec_double ("width",
-                                                       "Width",
-                                                       "Width",
-                                                       0.0, G_MAXDOUBLE,
-                                                       10.0,
-                                                       G_PARAM_READWRITE |
-                                                       G_PARAM_CONSTRUCT));
-  g_object_class_install_property (object_class, PROP_HEIGHT,
-                                   g_param_spec_double ("height",
-                                                       "Height",
-                                                       "Height",
-                                                       0.0, G_MAXDOUBLE,
-                                                       10.0,
-                                                       G_PARAM_READWRITE |
-                                                       G_PARAM_CONSTRUCT));
-
-
-}
-
-static void
-gegl_operation_crop_class_finalize (GeglOperationCropClass *klass)
-{
-}
-
-static void
-gegl_operation_crop_init (GeglOperationCrop *self)
-{
-}
-
-static void
-attach (GeglOperation *operation)
-{
-  GObjectClass *object_class = G_OBJECT_GET_CLASS (operation);
-
-  gegl_operation_create_pad (operation,
-                             g_object_class_find_property (object_class,
-                                                           "output"));
-  gegl_operation_create_pad (operation,
-                             g_object_class_find_property (object_class,
-                                                           "input"));
-}
-
 
 static GeglNode *
 detect (GeglOperation *operation,
         gint           x,
         gint           y)
 {
-  GeglOperationCrop *self = GEGL_OPERATION_CROP (operation);
-  GeglNode           *input_node;
+  GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+  GeglNode   *input_node;
 
   input_node = gegl_operation_get_source_node (operation, "input");
 
   if (input_node)
     return gegl_operation_detect (input_node->operation,
-                                  x - floor (self->x),
-                                  y - floor (self->y));
+                                  x - floor (o->x),
+                                  y - floor (o->y));
 
   return operation->node;
 }
 
-static void
-get_property (GObject    *object,
-              guint       property_id,
-              GValue     *value,
-              GParamSpec *pspec)
+
+static GeglRectangle
+get_defined_region (GeglOperation *operation)
 {
-  GeglOperationCrop *self = GEGL_OPERATION_CROP (object);
+  GeglChantO    *o = GEGL_CHANT_PROPERTIES (operation);
+  GeglRectangle *in_rect = gegl_operation_source_get_defined_region (operation, "input");
+  GeglRectangle  result  = { 0, 0, 0, 0 };
 
-  switch (property_id)
-    {
-    case PROP_X:
-      g_value_set_double (value, self->x);
-      break;
-
-    case PROP_Y:
-      g_value_set_double (value, self->y);
-      break;
-
-    case PROP_WIDTH:
-      g_value_set_double (value, self->width);
-      break;
-
-    case PROP_HEIGHT:
-      g_value_set_double (value, self->height);
-      break;
-
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-      break;
-    }
+  if (!in_rect)
+    return result;
+
+  result.x = o->x;
+  result.y = o->y;
+  result.width  = o->width;
+  result.height = o->height;
+
+  return result;
 }
 
-static void
-set_property (GObject      *object,
-              guint         property_id,
-              const GValue *value,
-              GParamSpec   *pspec)
+static GeglRectangle
+compute_affected_region (GeglOperation       *operation,
+                         const gchar         *input_pad,
+                         const GeglRectangle *input_region)
 {
-  GeglOperationCrop *self = GEGL_OPERATION_CROP (object);
+  GeglChantO   *o = GEGL_CHANT_PROPERTIES (operation);
+  GeglRectangle result = {o->x, o->y, o->width, o->height};
 
-  switch (property_id)
-    {
-    case PROP_X:
-      self->x = g_value_get_double (value);
-      break;
-
-    case PROP_Y:
-      self->y = g_value_get_double (value);
-      break;
-
-    case PROP_WIDTH:
-      self->width = g_value_get_double (value);
-      break;
-
-    case PROP_HEIGHT:
-      self->height = g_value_get_double (value);
-      break;
-
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-      break;
-    }
+  gegl_rectangle_intersect (&result, &result, input_region);
+
+  return result;
 }
 
+static GeglRectangle
+compute_input_request (GeglOperation       *operation,
+                       const gchar         *input_pad,
+                       const GeglRectangle *roi)
+{
+  return *roi;
+}
 
 static gboolean
 process (GeglOperation       *operation,
@@ -288,10 +96,10 @@
          const gchar         *output_prop,
          const GeglRectangle *result)
 {
-  GeglOperationCrop *crop   = GEGL_OPERATION_CROP (operation);
-  GeglBuffer         *input;
-  gboolean            success = FALSE;
-  GeglRectangle       extent = {crop->x, crop->y, crop->width, crop->height};
+  GeglChantO   *o = GEGL_CHANT_PROPERTIES (operation);
+  GeglBuffer   *input;
+  gboolean      success = FALSE;
+  GeglRectangle extent = {o->x, o->y, o->width, o->height};
 
   if (strcmp (output_prop, "output"))
     {
@@ -321,60 +129,25 @@
   return success;
 }
 
-static GeglRectangle
-get_defined_region (GeglOperation *operation)
-{
-  GeglRectangle      result  = { 0, 0, 0, 0 };
-  GeglOperationCrop *self    = GEGL_OPERATION_CROP (operation);
-  GeglRectangle     *in_rect = gegl_operation_source_get_defined_region (operation, "input");
 
-  if (!in_rect)
-    return result;
-
-  result.x = self->x;
-  result.y = self->y;
-  result.width = self->width;
-  result.height = self->height;
-
-  return result;
-}
-
-static GeglRectangle
-compute_affected_region (GeglOperation       *operation,
-                         const gchar         *input_pad,
-                         const GeglRectangle *input_region)
+static void
+operation_class_init (GeglChantClass *klass)
 {
-  GeglOperationCrop *self   = GEGL_OPERATION_CROP (operation);
-  GeglRectangle      result = {self->x, self->y, self->width, self->height};
+  GeglOperationClass *operation_class;
 
-  gegl_rectangle_intersect (&result, &result, input_region);
-
-  return result;
-}
-
-static GeglRectangle
-compute_input_request (GeglOperation       *operation,
-                       const gchar         *input_pad,
-                       const GeglRectangle *roi)
-{
-  return *roi;
-}
+  operation_class = GEGL_OPERATION_CLASS (klass);
+  operation_class->process = process;
+  operation_class->get_defined_region = get_defined_region;
+  operation_class->detect = detect;
+  operation_class->compute_affected_region = compute_affected_region;
+  operation_class->get_defined_region = get_defined_region;
+  operation_class->compute_input_request = compute_input_request;
 
-static const GeglModuleInfo modinfo =
-{
-  GEGL_MODULE_ABI_VERSION, "crop", "", ""
-};
+  operation_class->name        = "crop";
+  operation_class->categories  = "core";
+  operation_class->description = "Crop a buffer";
 
-G_MODULE_EXPORT const GeglModuleInfo *
-gegl_module_query (GTypeModule *module)
-{
-  return &modinfo;
+  operation_class->no_cache = TRUE;
 }
 
-G_MODULE_EXPORT gboolean
-gegl_module_register (GTypeModule *module)
-{
-  gegl_operation_crop_register_type (module);
-
-  return TRUE;
-}
+#endif

Modified: trunk/operations/core/nop.c
==============================================================================
--- trunk/operations/core/nop.c	(original)
+++ trunk/operations/core/nop.c	Sun Jan 27 23:40:17 2008
@@ -16,11 +16,14 @@
  * Copyright 2006 Ãyvind KolÃs <pippin gimp org>
  */
 #ifdef GEGL_CHANT_PROPERTIES
+
    /* no properties */
+
 #else
 
-#define GEGL_CHANT_C_FILE        "nop.c"
 #define GEGL_CHANT_TYPE_FILTER
+#define GEGL_CHANT_C_FILE       "nop.c"
+
 #include "gegl-chant.h"
 
 
@@ -59,7 +62,7 @@
 
   operation_class->name       = "nop";
   operation_class->categories = "core";
-  operation_class->description = "no operation (can be used as a routing point)";
+  operation_class->description = "No operation (can be used as a routing point)";
 }
 
 #endif

Modified: trunk/operations/core/shift.c
==============================================================================
--- trunk/operations/core/shift.c	(original)
+++ trunk/operations/core/shift.c	Sun Jan 27 23:40:17 2008
@@ -16,153 +16,19 @@
  * Copyright 2006 Ãyvind KolÃs
  */
 
-#ifndef __GEGL_OPERATION_SHIFT_H__
-#define __GEGL_OPERATION_SHIFT_H__
+#ifdef GEGL_CHANT_PROPERTIES
 
-#include <gegl-plugin.h>
+gegl_chant_double (x, -G_MAXFLOAT, G_MAXFLOAT, 0.0, "X-axis shift")
+gegl_chant_double (y, -G_MAXFLOAT, G_MAXFLOAT, 0.0, "Y-axis shift")
 
-G_BEGIN_DECLS
+#else
 
-#define GEGL_TYPE_OPERATION_SHIFT            (gegl_operation_shift_get_type ())
-#define GEGL_OPERATION_SHIFT(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEGL_TYPE_OPERATION_SHIFT, GeglOperationShift))
-#define GEGL_OPERATION_SHIFT_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  GEGL_TYPE_OPERATION_SHIFT, GeglOperationShiftClass))
-#define GEGL_IS_OPERATION_SHIFT(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEGL_TYPE_OPERATION_SHIFT))
-#define GEGL_IS_OPERATION_SHIFT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  GEGL_TYPE_OPERATION_SHIFT))
-#define GEGL_OPERATION_SHIFT_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  GEGL_TYPE_OPERATION_SHIFT, GeglOperationShiftClass))
+#define GEGL_CHANT_TYPE_FILTER
+#define GEGL_CHANT_C_FILE       "shift.c"
 
-typedef struct _GeglOperationShift      GeglOperationShift;
-typedef struct _GeglOperationShiftClass GeglOperationShiftClass;
-
-struct _GeglOperationShift
-{
-  GeglOperation parent_instance;
-
-  gdouble       x;
-  gdouble       y;
-};
-
-struct _GeglOperationShiftClass
-{
-  GeglOperationClass parent_class;
-};
-
-GType gegl_operation_shift_get_type (void) G_GNUC_CONST;
-
-G_END_DECLS
-
-#endif /* __GEGL_OPERATION_SHIFT_H__ */
-
-/***************************************************************************/
-
-#include "graph/gegl-pad.h"
+#include "gegl-chant.h"
 #include "graph/gegl-node.h"
 #include <math.h>
-#include <string.h>
-
-
-enum
-{
-  PROP_0,
-  PROP_OUTPUT,
-  PROP_INPUT,
-  PROP_X,
-  PROP_Y
-};
-
-static void            get_property            (GObject             *object,
-                                                guint                prop_id,
-                                                GValue              *value,
-                                                GParamSpec          *pspec);
-static void            set_property            (GObject             *object,
-                                                guint                prop_id,
-                                                const GValue        *value,
-                                                GParamSpec          *pspec);
-
-static gboolean        process                 (GeglOperation       *operation,
-                                                GeglNodeContext     *context,
-                                                const gchar         *output_prop,
-                                                const GeglRectangle *result);
-static void            attach                  (GeglOperation       *operation);
-static GeglNode      * detect                  (GeglOperation       *operation,
-                                                gint                 x,
-                                                gint                 y);
-static GeglRectangle   get_defined_region      (GeglOperation       *operation);
-static GeglRectangle   compute_input_request   (GeglOperation       *operation,
-                                                const gchar         *input_pad,
-                                                const GeglRectangle *roi);
-static GeglRectangle   compute_affected_region (GeglOperation       *operation,
-                                                const gchar         *input_pad,
-                                                const GeglRectangle *input_region);
-
-G_DEFINE_DYNAMIC_TYPE (GeglOperationShift, gegl_operation_shift,
-                       GEGL_TYPE_OPERATION)
-
-static void
-gegl_operation_shift_class_init (GeglOperationShiftClass *klass)
-{
-  GObjectClass       *object_class    = G_OBJECT_CLASS (klass);
-  GeglOperationClass *operation_class = GEGL_OPERATION_CLASS (klass);
-
-  object_class->set_property               = set_property;
-  object_class->get_property               = get_property;
-
-  operation_class->categories              = "core";
-  operation_class->no_cache                = TRUE;
-  operation_class->process                 = process;
-  operation_class->attach                  = attach;
-  operation_class->detect                  = detect;
-  operation_class->get_defined_region      = get_defined_region;
-  operation_class->compute_input_request   = compute_input_request;
-  operation_class->compute_affected_region = compute_affected_region;
-
-  gegl_operation_class_set_name (operation_class, "shift");
-
-  g_object_class_install_property (object_class, PROP_OUTPUT,
-                                   g_param_spec_object ("output",
-                                                        "Output",
-                                                        "Ouput pad for generated image buffer.",
-                                                        GEGL_TYPE_BUFFER,
-                                                        G_PARAM_READABLE |
-                                                        GEGL_PARAM_PAD_OUTPUT));
-
-  g_object_class_install_property (object_class, PROP_INPUT,
-                                   g_param_spec_object ("input",
-                                                        "Input",
-                                                        "Input pad, for image buffer input.",
-                                                        GEGL_TYPE_BUFFER,
-                                                        G_PARAM_READWRITE |
-                                                        GEGL_PARAM_PAD_INPUT));
-
-  g_object_class_install_property (object_class, PROP_X,
-                                   g_param_spec_double ("x",
-                                                       "X",
-                                                       "X",
-                                                       -G_MAXDOUBLE, G_MAXDOUBLE,
-                                                       0.0,
-                                                       G_PARAM_READWRITE |
-                                                       G_PARAM_CONSTRUCT));
-
-  g_object_class_install_property (object_class, PROP_Y,
-                                   g_param_spec_double ("y",
-                                                       "Y",
-                                                       "Y",
-                                                       -G_MAXDOUBLE, G_MAXDOUBLE,
-                                                       0.0,
-                                                       G_PARAM_READWRITE |
-                                                       G_PARAM_CONSTRUCT));
-
-
-}
-
-static void
-gegl_operation_shift_class_finalize (GeglOperationShiftClass *klass)
-{
-}
-
-static void
-gegl_operation_shift_init (GeglOperationShift *self)
-{
-}
 
 static void
 attach (GeglOperation *operation)
@@ -177,73 +43,69 @@
                                                            "input"));
 }
 
-
 static GeglNode *
 detect (GeglOperation *operation,
         gint           x,
         gint           y)
 {
-  GeglOperationShift *self = GEGL_OPERATION_SHIFT (operation);
-  GeglNode           *input_node;
+  GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+  GeglNode   *input_node;
 
   input_node = gegl_operation_get_source_node (operation, "input");
 
   if (input_node)
     return gegl_operation_detect (input_node->operation,
-                                  x - floor (self->x),
-                                  y - floor (self->y));
+                                  x - floor (o->x),
+                                  y - floor (o->y));
 
   return operation->node;
 }
 
-static void
-get_property (GObject    *object,
-              guint       property_id,
-              GValue     *value,
-              GParamSpec *pspec)
+static GeglRectangle
+get_defined_region (GeglOperation *operation)
 {
-  GeglOperationShift *self = GEGL_OPERATION_SHIFT (object);
+  GeglChantO    *o = GEGL_CHANT_PROPERTIES (operation);
+  GeglRectangle *in_rect = gegl_operation_source_get_defined_region (operation, "input");
+  GeglRectangle  result  = { 0, 0, 0, 0 };
 
-  switch (property_id)
-    {
-    case PROP_X:
-      g_value_set_double (value, self->x);
-      break;
-
-    case PROP_Y:
-      g_value_set_double (value, self->y);
-      break;
-
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-      break;
-    }
+  if (!in_rect)
+    return result;
+
+  result = *in_rect;
+
+  result.x += floor (o->x);
+  result.y += floor (o->y);
+
+  return result;
 }
 
-static void
-set_property (GObject      *object,
-              guint         property_id,
-              const GValue *value,
-              GParamSpec   *pspec)
+static GeglRectangle
+compute_affected_region (GeglOperation       *operation,
+                         const gchar         *input_pad,
+                         const GeglRectangle *input_region)
 {
-  GeglOperationShift *self = GEGL_OPERATION_SHIFT (object);
+  GeglChantO   *o = GEGL_CHANT_PROPERTIES (operation);
+  GeglRectangle result = *input_region;
 
-  switch (property_id)
-    {
-    case PROP_X:
-      self->x = g_value_get_double (value);
-      break;
-
-    case PROP_Y:
-      self->y = g_value_get_double (value);
-      break;
-
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-      break;
-    }
+  result.x += floor (o->x);
+  result.y += floor (o->y);
+
+  return result;
 }
 
+static GeglRectangle
+compute_input_request (GeglOperation       *operation,
+                       const gchar         *input_pad,
+                       const GeglRectangle *roi)
+{
+  GeglChantO   *o = GEGL_CHANT_PROPERTIES (operation);
+  GeglRectangle result = *roi;
+
+  result.x -= floor (o->x);
+  result.y -= floor (o->y);
+
+  return result;
+}
 
 static gboolean
 process (GeglOperation       *operation,
@@ -251,12 +113,12 @@
          const gchar         *output_prop,
          const GeglRectangle *result)
 {
-  GeglOperationShift *shift   = GEGL_OPERATION_SHIFT (operation);
-  GeglBuffer         *input;
-  gboolean            success = FALSE;
+  GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+  GeglBuffer *input;
+  gboolean    success = FALSE;
 
-  shift->x = floor (shift->x);
-  shift->y = floor (shift->y);
+  o->x = floor (o->x);
+  o->y = floor (o->y);
 
   if (strcmp (output_prop, "output"))
     {
@@ -272,8 +134,8 @@
 
       output = g_object_new (GEGL_TYPE_BUFFER,
                              "provider",    input,
-                             "shift-x",     (int)-shift->x,
-                             "shift-y",     (int)-shift->y,
+                             "shift-x",     (int)-o->x,
+                             "shift-y",     (int)-o->y,
                              "abyss-width", -1,  /* turn of abyss
                                                     (relying on abyss
                                                     of source) */
@@ -296,67 +158,25 @@
   return success;
 }
 
-static GeglRectangle
-get_defined_region (GeglOperation *operation)
-{
-  GeglOperationShift *self    = GEGL_OPERATION_SHIFT (operation);
-  GeglRectangle       result  = { 0, 0, 0, 0 };
-  GeglRectangle      *in_rect = gegl_operation_source_get_defined_region (operation, "input");
-
-  if (!in_rect)
-    return result;
-
-  result = *in_rect;
-
-  result.x += floor (self->x);
-  result.y += floor (self->y);
 
-  return result;
-}
-
-static GeglRectangle
-compute_affected_region (GeglOperation       *operation,
-                         const gchar         *input_pad,
-                         const GeglRectangle *input_region)
-{
-  GeglOperationShift *self   = GEGL_OPERATION_SHIFT (operation);
-  GeglRectangle       result = *input_region;
-
-  result.x += floor (self->x);
-  result.y += floor (self->y);
-
-  return result;
-}
-
-static GeglRectangle
-compute_input_request (GeglOperation       *operation,
-                       const gchar         *input_pad,
-                       const GeglRectangle *roi)
+static void
+operation_class_init (GeglChantClass *klass)
 {
-  GeglOperationShift *self   = GEGL_OPERATION_SHIFT (operation);
-  GeglRectangle       result = *roi;
-
-  result.x -= floor (self->x);
-  result.y -= floor (self->y);
+  GeglOperationClass *operation_class;
 
-  return result;
-}
+  operation_class = GEGL_OPERATION_CLASS (klass);
+  operation_class->process                 = process;
+  operation_class->attach                  = attach;
+  operation_class->detect                  = detect;
+  operation_class->get_defined_region      = get_defined_region;
+  operation_class->compute_input_request   = compute_input_request;
+  operation_class->compute_affected_region = compute_affected_region;
 
-static const GeglModuleInfo modinfo =
-{
-  GEGL_MODULE_ABI_VERSION, "shift", "", ""
-};
+  operation_class->name        = "shift";
+  operation_class->categories  = "core";
+  operation_class->description = "Shift the contents of a buffer";
 
-G_MODULE_EXPORT const GeglModuleInfo *
-gegl_module_query (GTypeModule *module)
-{
-  return &modinfo;
+  operation_class->no_cache = TRUE;
 }
 
-G_MODULE_EXPORT gboolean
-gegl_module_register (GTypeModule *module)
-{
-  gegl_operation_shift_register_type (module);
-
-  return TRUE;
-}
+#endif

Modified: trunk/operations/io/jpg-load.c
==============================================================================
--- trunk/operations/io/jpg-load.c	(original)
+++ trunk/operations/io/jpg-load.c	Sun Jan 27 23:40:17 2008
@@ -15,93 +15,20 @@
  *
  * Copyright 2006 Ãyvind KolÃs <pippin gimp org>
  */
-#if GEGL_CHANT_PROPERTIES
- 
+#ifdef GEGL_CHANT_PROPERTIES
+
 gegl_chant_path (path, "/tmp/romedalen.jpg", "Path of file to load.")
 
 #else
 
-#define GEGL_CHANT_SOURCE
-#define GEGL_CHANT_NAME            jpg_load
-#define GEGL_CHANT_DESCRIPTION     "JPG image loader"
-#define GEGL_CHANT_SELF            "jpg-load.c"
-#define GEGL_CHANT_CATEGORIES      "hidden"
-#define GEGL_CHANT_CLASS_INIT
-#include "gegl-old-chant.h"
+#define GEGL_CHANT_TYPE_SOURCE
+#define GEGL_CHANT_C_FILE       "jpg-load.c"
+
+#include "gegl-chant.h"
 #include <stdio.h>
 #include <jpeglib.h>
 
 static gint
-gegl_buffer_import_jpg (GeglBuffer  *gegl_buffer,
-                        const gchar *path,
-                        gint         dest_x,
-                        gint         dest_y);
-
-static gint
-query_jpg (const gchar *path,
-           gint        *width,
-           gint        *height);
-
-static gboolean
-process (GeglOperation       *operation,
-         GeglNodeContext     *context,
-         GeglBuffer          *output,
-         const GeglRectangle *result)
-{
-  GeglChantOperation  *self = GEGL_CHANT_OPERATION (operation);
-  GeglRectangle        rect={0,0};
-  gint                 problem;
-  
-  problem = query_jpg (self->path, &rect.width, &rect.height);
-
-  if (problem)
-    {
-      g_warning ("%s failed to open file %s for reading.",
-        G_OBJECT_TYPE_NAME (operation), self->path);
-      return FALSE;
-    }
-
-
-  problem = gegl_buffer_import_jpg (output, self->path, 0, 0);
-
-  if (problem)
-    {
-      g_warning ("%s failed to open file %s for reading.",
-        G_OBJECT_TYPE_NAME (operation), self->path);
-      
-      return FALSE;
-    }
-  
-  return  TRUE;
-}
-
-
-static GeglRectangle
-get_defined_region (GeglOperation *operation)
-{
-  GeglRectangle result = {0,0,0,0};
-  GeglChantOperation       *self      = GEGL_CHANT_OPERATION (operation);
-  gint width, height;
-  gint status;
-  gegl_operation_set_format (operation, "output", babl_format ("R'G'B' u8"));
-  status = query_jpg (self->path, &width, &height);
-
-  if (status)
-    {
-      /*g_warning ("calc have rect of %s failed", self->path);*/
-      result.width  = 10;
-      result.height  = 10;
-    }
-  else
-    {
-      result.width  = width;
-      result.height  = height;
-    }
-
-  return result;
-}
-
-static gint
 query_jpg (const gchar *path,
            gint        *width,
            gint        *height)
@@ -196,16 +123,88 @@
   return 0;
 }
 
-static void class_init (GeglOperationClass *operation_class)
+static GeglRectangle
+get_defined_region (GeglOperation *operation)
+{
+  GeglChantO   *o = GEGL_CHANT_PROPERTIES (operation);
+  GeglRectangle result = {0,0,0,0};
+  gint width, height;
+  gint status;
+  gegl_operation_set_format (operation, "output", babl_format ("R'G'B' u8"));
+  status = query_jpg (o->path, &width, &height);
+
+  if (status)
+    {
+      /*g_warning ("calc have rect of %s failed", o->path);*/
+      result.width  = 10;
+      result.height  = 10;
+    }
+  else
+    {
+      result.width  = width;
+      result.height  = height;
+    }
+
+  return result;
+}
+
+static gboolean
+process (GeglOperation       *operation,
+         GeglNodeContext     *context,
+         GeglBuffer          *output,
+         const GeglRectangle *result)
 {
-  static gboolean done=FALSE;
-  if (done)
-    return;
+  GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+  GeglRectangle        rect={0,0};
+  gint                 problem;
+
+  problem = query_jpg (o->path, &rect.width, &rect.height);
+
+  if (problem)
+    {
+      g_warning ("%s failed to open file %s for reading.",
+        G_OBJECT_TYPE_NAME (operation), o->path);
+      return FALSE;
+    }
+
+
+  problem = gegl_buffer_import_jpg (output, o->path, 0, 0);
+
+  if (problem)
+    {
+      g_warning ("%s failed to open file %s for reading.",
+        G_OBJECT_TYPE_NAME (operation), o->path);
+
+      return FALSE;
+    }
+
+  return  TRUE;
+}
+
+
+static void
+operation_class_init (GeglChantClass *klass)
+{
+  GeglOperationClass       *operation_class;
+  GeglOperationSourceClass *source_class;
+
+  operation_class = GEGL_OPERATION_CLASS (klass);
+  source_class    = GEGL_OPERATION_SOURCE_CLASS (klass);
+
+  source_class->process = process;
+  operation_class->get_defined_region = get_defined_region;
+
+  operation_class->name        = "jpg-load";
+  operation_class->categories  = "hidden";
+  operation_class->description = "JPG image loader";
+
+//  static gboolean done=FALSE;
+//  if (done)
+//    return;
   gegl_extension_handler_register (".jpg", "jpg-load");
   gegl_extension_handler_register (".JPG", "jpg-load");
   gegl_extension_handler_register (".jpeg", "jpg-load");
   gegl_extension_handler_register (".JPEG", "jpg-load");
-  done = TRUE;
+//  done = TRUE;
 }
-
 #endif

Modified: trunk/operations/io/pixbuf.c
==============================================================================
--- trunk/operations/io/pixbuf.c	(original)
+++ trunk/operations/io/pixbuf.c	Sun Jan 27 23:40:17 2008
@@ -15,59 +15,74 @@
  *
  * Copyright 2006 Ãyvind KolÃs <pippin gimp org>
  */
-#if GEGL_CHANT_PROPERTIES
+#ifdef GEGL_CHANT_PROPERTIES
 gegl_chant_pointer (pixbuf, "GdkPixbuf to use")
 #else
 
-#define GEGL_CHANT_SOURCE
-#define GEGL_CHANT_NAME            pixbuf
-#define GEGL_CHANT_DESCRIPTION     "Uses the GdkPixbuf located at the memory location in <em>pixbuf</em>."
-
-#define GEGL_CHANT_SELF            "pixbuf.c"
-#define GEGL_CHANT_CATEGORIES      "programming:input"
-#include "gegl-old-chant.h"
+#define GEGL_CHANT_TYPE_SOURCE
+#define GEGL_CHANT_C_FILE       "pixbuf.c"
 
+#include "gegl-chant.h"
 #include <gdk-pixbuf/gdk-pixbuf.h>
 #include <gdk-pixbuf/gdk-pixdata.h>
 
+static GeglRectangle
+get_defined_region (GeglOperation *operation)
+{
+  GeglChantO   *o = GEGL_CHANT_PROPERTIES (operation);
+  GeglRectangle result = {0,0,0,0};
+
+  if (!o->pixbuf)
+    {
+      return result;
+    }
+
+  result.x = 0;
+  result.y = 0;
+  result.width  = gdk_pixbuf_get_width (o->pixbuf);
+  result.height = gdk_pixbuf_get_height (o->pixbuf);
+  return result;
+}
+
 static gboolean
 process (GeglOperation       *operation,
          GeglNodeContext     *context,
          GeglBuffer          *output,  /* ignored */
          const GeglRectangle *result)
 {
-  GeglChantOperation  *self      = GEGL_CHANT_OPERATION (operation);
+  GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
 
-  if (self->pixbuf)
+  if (o->pixbuf)
     {
       GeglRectangle extent = {0,0,
-                              gdk_pixbuf_get_width (self->pixbuf),
-                              gdk_pixbuf_get_height (self->pixbuf)};
-      GeglBuffer *output = gegl_buffer_new (&extent, 
-  babl_format(gdk_pixbuf_get_has_alpha(self->pixbuf)?"R'G'B'A u8":"R'G'B' u8"));
-      gegl_buffer_set (output, NULL, NULL, gdk_pixbuf_get_pixels (self->pixbuf),
+                              gdk_pixbuf_get_width (o->pixbuf),
+                              gdk_pixbuf_get_height (o->pixbuf)};
+      GeglBuffer *output = gegl_buffer_new (&extent,
+  babl_format(gdk_pixbuf_get_has_alpha(o->pixbuf)?"R'G'B'A u8":"R'G'B' u8"));
+      gegl_buffer_set (output, NULL, NULL, gdk_pixbuf_get_pixels (o->pixbuf),
                        GEGL_AUTO_ROWSTRIDE);
       gegl_node_context_set_object (context, "output", G_OBJECT (output));
     }
   return TRUE;
 }
 
-static GeglRectangle
-get_defined_region (GeglOperation *operation)
+
+static void
+operation_class_init (GeglChantClass *klass)
 {
-  GeglRectangle result = {0,0,0,0};
-  GeglChantOperation *self = GEGL_CHANT_OPERATION (operation);
+  GeglOperationClass       *operation_class;
+  GeglOperationSourceClass *source_class;
 
-  if (!self->pixbuf)
-    {
-      return result;
-    }
-    
-  result.x = 0;
-  result.y = 0;
-  result.width  = gdk_pixbuf_get_width (self->pixbuf);
-  result.height  = gdk_pixbuf_get_height (self->pixbuf);
-  return result;
+  operation_class = GEGL_OPERATION_CLASS (klass);
+  source_class    = GEGL_OPERATION_SOURCE_CLASS (klass);
+
+  source_class->process = process;
+  operation_class->get_defined_region = get_defined_region;
+
+  operation_class->name        = "pixbuf";
+  operation_class->categories  = "programming:input";
+  operation_class->description =
+        "Uses the GdkPixbuf located at the memory location in <em>pixbuf</em>.";
 }
 
 #endif

Modified: trunk/operations/io/png-load.c
==============================================================================
--- trunk/operations/io/png-load.c	(original)
+++ trunk/operations/io/png-load.c	Sun Jan 27 23:40:17 2008
@@ -17,20 +17,16 @@
  *           2006 Dominik Ernst <dernst gmx de>
  *           2006 Kevin Cozens <kcozens cvs gnome org>
  */
-#if GEGL_CHANT_PROPERTIES
+#ifdef GEGL_CHANT_PROPERTIES
 
 gegl_chant_path (path, "/tmp/romedalen.png", "Path of file to load.")
 
 #else
 
-#define GEGL_CHANT_SOURCE
-#define GEGL_CHANT_NAME            png_load
-#define GEGL_CHANT_DESCRIPTION     "PNG image loader."
-#define GEGL_CHANT_SELF            "png-load.c"
-#define GEGL_CHANT_CATEGORIES      "hidden"
-#define GEGL_CHANT_CLASS_INIT
-#include "gegl-old-chant.h"
+#define GEGL_CHANT_TYPE_SOURCE
+#define GEGL_CHANT_C_FILE       "png-load.c"
 
+#include "gegl-chant.h"
 #include <png.h>
 
 static gint
@@ -40,79 +36,6 @@
                         gint         dest_y,
                         gint        *ret_width,
                         gint        *ret_height,
-                        gpointer     format);
-
-gint query_png (const gchar *path,
-                gint        *width,
-                gint        *height,
-                gpointer    *format);
-
-static gboolean
-process (GeglOperation       *operation,
-         GeglNodeContext     *context,
-         GeglBuffer          *output,
-         const GeglRectangle *result)
-{
-  GeglChantOperation       *self = GEGL_CHANT_OPERATION (operation);
-  gint          problem;
-  gpointer      format;
-  gint width, height;
-
-
-  problem = query_png (self->path, &width, &height, &format);
-  if (problem)
-    {
-      g_warning ("%s is %s really a PNG file?",
-      G_OBJECT_TYPE_NAME (operation), self->path);
-      return FALSE;
-    }
-
-
-  problem = gegl_buffer_import_png (output, self->path, 0, 0,
-                                    &width, &height, format);
-
-  if (problem)
-    {
-      g_warning ("%s failed to open file %s for reading.",
-                 G_OBJECT_TYPE_NAME (operation), self->path);
-      return FALSE;
-    }
-  return  TRUE;
-}
-
-
-static GeglRectangle
-get_defined_region (GeglOperation *operation)
-{
-  GeglRectangle result = {0,0,0,0};
-  GeglChantOperation       *self = GEGL_CHANT_OPERATION (operation);
-  /*GeglOperationSource *source = GEGL_OPERATION_SOURCE (operation);*/
-  gint width, height;
-  gint status;
-  gpointer format;
-
-    {
-      status = query_png (self->path, &width, &height, &format);
-
-      if (status)
-        {
-          width=10;
-          height=10;
-        }
-    }
-  gegl_operation_set_format (operation, "output", format);
-  result.width  = width;
-  result.height  = height;
-  return result;
-}
-
-static gint
-gegl_buffer_import_png (GeglBuffer  *gegl_buffer,
-                        const gchar *path,
-                        gint         dest_x,
-                        gint         dest_y,
-                        gint        *ret_width,
-                        gint        *ret_height,
                         gpointer     format)
 {
   gint           width;
@@ -425,14 +348,84 @@
   return 0;
 }
 
-static void class_init (GeglOperationClass *operation_class)
+static GeglRectangle
+get_defined_region (GeglOperation *operation)
+{
+  GeglChantO   *o = GEGL_CHANT_PROPERTIES (operation);
+  GeglRectangle result = {0,0,0,0};
+  gint          width, height;
+  gint          status;
+  gpointer      format;
+
+  status = query_png (o->path, &width, &height, &format);
+
+  if (status)
+    {
+      width=10;
+      height=10;
+    }
+
+  gegl_operation_set_format (operation, "output", format);
+  result.width  = width;
+  result.height  = height;
+  return result;
+}
+
+static gboolean
+process (GeglOperation       *operation,
+         GeglNodeContext     *context,
+         GeglBuffer          *output,
+         const GeglRectangle *result)
+{
+  GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+  gint        problem;
+  gpointer    format;
+  gint        width, height;
+
+  problem = query_png (o->path, &width, &height, &format);
+  if (problem)
+    {
+      g_warning ("%s is %s really a PNG file?",
+      G_OBJECT_TYPE_NAME (operation), o->path);
+      return FALSE;
+    }
+
+  problem = gegl_buffer_import_png (output, o->path, 0, 0,
+                                    &width, &height, format);
+
+  if (problem)
+    {
+      g_warning ("%s failed to open file %s for reading.",
+                 G_OBJECT_TYPE_NAME (operation), o->path);
+      return FALSE;
+    }
+
+  return  TRUE;
+}
+
+
+static void
+operation_class_init (GeglChantClass *klass)
 {
-  static gboolean done=FALSE;
-  if (done)
-    return;
+  GeglOperationClass       *operation_class;
+  GeglOperationSourceClass *source_class;
+
+  operation_class = GEGL_OPERATION_CLASS (klass);
+  source_class    = GEGL_OPERATION_SOURCE_CLASS (klass);
+
+  source_class->process = process;
+  operation_class->get_defined_region = get_defined_region;
+
+  operation_class->name        = "png-load";
+  operation_class->categories  = "hidden";
+  operation_class->description = "PNG image loader.";
+
+//  static gboolean done=FALSE;
+//  if (done)
+//    return;
   gegl_extension_handler_register (".png", "png-load");
   gegl_extension_handler_register (".PNG", "png-load");
-  done = TRUE;
+//  done = TRUE;
 }
 
 #endif

Modified: trunk/operations/io/png-save.c
==============================================================================
--- trunk/operations/io/png-save.c	(original)
+++ trunk/operations/io/png-save.c	Sun Jan 27 23:40:17 2008
@@ -16,22 +16,19 @@
  * Copyright 2006 Ãyvind KolÃs <pippin gimp org>
  *           2006 Dominik Ernst <dernst gmx de>
  */
-#if GEGL_CHANT_PROPERTIES
- 
+#ifdef GEGL_CHANT_PROPERTIES
+
 gegl_chant_string (path, "/tmp/fnord.png", "Target path and filename, use '-' for stdout.")
-gegl_chant_int	  (compression, 1, 9, 1, "PNG compression level from 1 to 9")
+gegl_chant_int    (compression, 1, 9, 1, "PNG compression level from 1 to 9")
 
 #else
 
-#define GEGL_CHANT_SINK
-#define GEGL_CHANT_NAME        png_save
-#define GEGL_CHANT_DESCRIPTION "PNG image saver (passes the buffer through, saves as a side-effect.)"
-#define GEGL_CHANT_SELF        "png-save.c"
-#define GEGL_CHANT_CATEGORIES      "output"
-#define GEGL_CHANT_CLASS_INIT
-#include "gegl-old-chant.h"
+#define GEGL_CHANT_TYPE_SINK
+#define GEGL_CHANT_C_FILE       "png-save.c"
 
+#include "gegl-chant.h"
 #include <png.h>
+#include <stdio.h>
 
 gint
 gegl_buffer_export_png (GeglBuffer  *gegl_buffer,
@@ -40,31 +37,7 @@
                         gint         src_x,
                         gint         src_y,
                         gint         width,
-                        gint         height);
-
-static gboolean
-process (GeglOperation       *operation,
-         GeglBuffer          *input,
-         const GeglRectangle *result)
-{
-  GeglChantOperation  *self   = GEGL_CHANT_OPERATION (operation);
-
-  gegl_buffer_export_png (input, self->path, self->compression,
-                          result->x, result->y,
-                          result->width, result->height);
-  return  TRUE;
-}
-
-#include <stdio.h>
-
-gint
-gegl_buffer_export_png (GeglBuffer      *gegl_buffer,
-                        const gchar     *path,
-			gint		 compression,
-                        gint             src_x,
-                        gint             src_y,
-                        gint             width,
-                        gint             height)
+                        gint         height)
 {
   gint           row_stride = width * 4;
   FILE          *fp;
@@ -94,7 +67,7 @@
   {
     const Babl *babl; /*= gegl_buffer->format;*/
     BablType   **type;
- 
+
     g_object_get (gegl_buffer, "format", &babl, NULL);
     type = babl->format.type;
 
@@ -161,9 +134,37 @@
   return 0;
 }
 
-static void class_init (GeglOperationClass *operation_class)
+static gboolean
+process (GeglOperation       *operation,
+         GeglBuffer          *input,
+         const GeglRectangle *result)
 {
-  GEGL_OPERATION_SINK_CLASS (operation_class)->needs_full = TRUE;
+  GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+
+  gegl_buffer_export_png (input, o->path, o->compression,
+                          result->x, result->y,
+                          result->width, result->height);
+  return  TRUE;
+}
+
+
+static void
+operation_class_init (GeglChantClass *klass)
+{
+  GeglOperationClass     *operation_class;
+  GeglOperationSinkClass *sink_class;
+
+  operation_class = GEGL_OPERATION_CLASS (klass);
+  sink_class      = GEGL_OPERATION_SINK_CLASS (klass);
+
+  sink_class->process = process;
+  sink_class->needs_full = TRUE;
+
+  operation_class->name        = "png-save";
+  operation_class->categories  = "output";
+  operation_class->description =
+        "PNG image saver (passes the buffer through, saves as a side-effect.)";
+
 }
 
 #endif

Modified: trunk/operations/io/save-buffer.c
==============================================================================
--- trunk/operations/io/save-buffer.c	(original)
+++ trunk/operations/io/save-buffer.c	Sun Jan 27 23:40:17 2008
@@ -15,39 +15,50 @@
  *
  * Copyright 2006 Ãyvind KolÃs <pippin gimp org>
  */
-#if GEGL_CHANT_PROPERTIES
+#ifdef GEGL_CHANT_PROPERTIES
+
 gegl_chant_pointer (buffer, "The location where to store the output GeglBuffer")
+
 #else
 
-#define GEGL_CHANT_SINK
-#define GEGL_CHANT_NAME        save_buffer
-#define GEGL_CHANT_DESCRIPTION "A GEGL buffer destination surface."
-#define GEGL_CHANT_SELF        "save-buffer.c"
-#define GEGL_CHANT_CATEGORIES  "programming:output"
-#define GEGL_CHANT_CLASS_INIT
-#include "gegl-old-chant.h"
+#define GEGL_CHANT_TYPE_SINK
+#define GEGL_CHANT_C_FILE       "save-buffer.c"
+
+#include "gegl-chant.h"
 
 static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
          const GeglRectangle *result)
 {
-  GeglChantOperation  *self;
+  GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
 
-  self = GEGL_CHANT_OPERATION (operation);
-
-  if (self->buffer)
+  if (o->buffer)
     {
-      GeglBuffer **output = self->buffer;
+      GeglBuffer **output = o->buffer;
 
       *output = gegl_buffer_create_sub_buffer (input, result);
     }
+
   return TRUE;
 }
 
-static void class_init (GeglOperationClass *operation_class)
+
+static void
+operation_class_init (GeglChantClass *klass)
 {
-  GEGL_OPERATION_SINK_CLASS (operation_class)->needs_full = TRUE;
+  GeglOperationClass     *operation_class;
+  GeglOperationSinkClass *sink_class;
+
+  operation_class = GEGL_OPERATION_CLASS (klass);
+  sink_class      = GEGL_OPERATION_SINK_CLASS (klass);
+
+  sink_class->process = process;
+  sink_class->needs_full = TRUE;
+
+  operation_class->name        = "save-buffer";
+  operation_class->categories  = "programming:output";
+  operation_class->description = "A GEGL buffer destination surface.";
 }
 
 #endif

Modified: trunk/operations/io/save-pixbuf.c
==============================================================================
--- trunk/operations/io/save-pixbuf.c	(original)
+++ trunk/operations/io/save-pixbuf.c	Sun Jan 27 23:40:17 2008
@@ -15,19 +15,16 @@
  *
  * Copyright 2007 Ãtienne Bersac <bersace03 laposte net>
  */
-#if GEGL_CHANT_PROPERTIES
+#ifdef GEGL_CHANT_PROPERTIES
 
 gegl_chant_pointer (pixbuf, "The location where to store the output GdkPixuf.")
 
 #else
 
-#define GEGL_CHANT_SINK
-#define GEGL_CHANT_NAME            save_pixbuf
-#define GEGL_CHANT_DESCRIPTION     "Save output into a GdkPixbuf."
-#define GEGL_CHANT_SELF            "save-pixbuf.c"
-#define GEGL_CHANT_CATEGORIES      "programming:output"
-#define GEGL_CHANT_CLASS_INIT
-#include "gegl-old-chant.h"
+#define GEGL_CHANT_TYPE_SINK
+#define GEGL_CHANT_C_FILE       "save-pixbuf.c"
+
+#include "gegl-chant.h"
 #include <gdk-pixbuf/gdk-pixbuf.h>
 
 static gboolean
@@ -35,15 +32,15 @@
          GeglBuffer          *input,
          const GeglRectangle *result)
 {
-  GeglChantOperation  *self = GEGL_CHANT_OPERATION (operation);
+  GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
 
-  if (self->pixbuf)
+  if (o->pixbuf)
     {
-      GdkPixbuf		**pixbuf = self->pixbuf;
-      const Babl        *babl;
-      const BablFormat  *format;
-      guchar        	*temp;
-      GeglRectangle	*rect = gegl_operation_source_get_defined_region (operation, "input");
+      GdkPixbuf       **pixbuf = o->pixbuf;
+      const Babl       *babl;
+      const BablFormat *format;
+      guchar           *temp;
+      GeglRectangle *rect = gegl_operation_source_get_defined_region (operation, "input");
       gchar *name;
       gboolean has_alpha;
       gint bps;
@@ -54,29 +51,29 @@
 
       has_alpha = FALSE;
       for (i = 0; i < format->components; i++) {
-	has_alpha = has_alpha || format->component[i]->alpha != 0;
+    has_alpha = has_alpha || format->component[i]->alpha != 0;
       }
 
       /* pixbuf from data only support 8bit bps */
       bps = 8;
       name = g_strdup_printf ("RGB%s u%i",
-			      has_alpha ? "A" : "",
-			      bps);
+                  has_alpha ? "A" : "",
+                  bps);
       babl = babl_format (name);
 
       temp = g_malloc (rect->width * rect->height * bps);
       gegl_buffer_get (input, 1.0, rect, babl, temp, GEGL_AUTO_ROWSTRIDE);
       if (temp) {
-	*pixbuf = gdk_pixbuf_new_from_data (temp,
-					    GDK_COLORSPACE_RGB,
-					    has_alpha,
-					    bps,
-					    rect->width, rect->height,
-					    rect->width * (has_alpha ? 4 : 3) * bps/8,
-					    (GdkPixbufDestroyNotify) g_free, NULL);
+    *pixbuf = gdk_pixbuf_new_from_data (temp,
+                        GDK_COLORSPACE_RGB,
+                        has_alpha,
+                        bps,
+                        rect->width, rect->height,
+                        rect->width * (has_alpha ? 4 : 3) * bps/8,
+                        (GdkPixbufDestroyNotify) g_free, NULL);
       }
       else {
-	g_warning (G_STRLOC ": inexistant data, unable to create GdkPixbuf.");
+    g_warning (G_STRLOC ": inexistant data, unable to create GdkPixbuf.");
       }
 
       g_free (name);
@@ -84,9 +81,23 @@
   return TRUE;
 }
 
-static void class_init (GeglOperationClass *operation_class)
+
+static void
+operation_class_init (GeglChantClass *klass)
 {
-  GEGL_OPERATION_SINK_CLASS (operation_class)->needs_full = TRUE;
+  GeglOperationClass     *operation_class;
+  GeglOperationSinkClass *sink_class;
+
+  operation_class = GEGL_OPERATION_CLASS (klass);
+  sink_class      = GEGL_OPERATION_SINK_CLASS (klass);
+
+  sink_class->process = process;
+  sink_class->needs_full = TRUE;
+
+  operation_class->name        = "save-pixbuf";
+  operation_class->categories  = "programming:output";
+  operation_class->description = "Save output into a GdkPixbuf.";
+
 }
 
 #endif

Modified: trunk/operations/io/svg-load.c
==============================================================================
--- trunk/operations/io/svg-load.c	(original)
+++ trunk/operations/io/svg-load.c	Sun Jan 27 23:40:17 2008
@@ -23,14 +23,10 @@
 
 #else
 
-#define GEGL_CHANT_SOURCE
-#define GEGL_CHANT_NAME            svg_load
-#define GEGL_CHANT_DESCRIPTION     "Load an SVG file using librsvg"
-#define GEGL_CHANT_SELF            "svg-load.c"
-#define GEGL_CHANT_CATEGORIES      "input" /* not hidden because it has extra API */
-#define GEGL_CHANT_CLASS_INIT
-#include "gegl-old-chant.h"
+#define GEGL_CHANT_TYPE_SOURCE
+#define GEGL_CHANT_C_FILE       "svg-load.c"
 
+#include "gegl-chant.h"
 #include <cairo.h>
 #include <librsvg/rsvg.h>
 #include <librsvg/rsvg-cairo.h>
@@ -56,100 +52,6 @@
                         gint         dest_x,
                         gint         dest_y,
                         gint        *ret_width,
-                        gint        *ret_height);
-
-gint query_svg (const gchar *path,
-                gint        *width,
-                gint        *height);
-
-static gboolean
-process (GeglOperation       *operation,
-         GeglNodeContext     *context,
-         GeglBuffer          *output,
-         const GeglRectangle *result_foo)
-{
-  GeglChantOperation  *self = GEGL_CHANT_OPERATION (operation);
-  gint                 result;
-
-  {
-    gint width, height;
-
-      width  = self->width;
-      height = self->height;
-      result = query_svg (self->path, &width, &height);
-      if (result == FALSE)
-        {
-          g_warning ("%s failed to open file %s for reading.",
-            G_OBJECT_TYPE_NAME (operation), self->path);
-            output = gegl_buffer_new (NULL, NULL);
-              return TRUE;
-        }
-
-        {
-          GeglRectangle extent={0,0,width,height};
-          /* FIXME: the format should be set on the pad prior to the actual
-           * load
-           */
-          output = gegl_buffer_new (&extent, babl_format ("R'G'B'A u8"));
-        }
-
-    result = gegl_buffer_import_svg (output, self->path,
-                                     width, height, 0, 0, &width, &height);
-    if (result)
-      {
-        g_warning ("%s failed to open file %s for reading.",
-          G_OBJECT_TYPE_NAME (operation), self->path);
-        return  FALSE;
-      }
-    gegl_node_context_set_object (context, "output", G_OBJECT (output));
-
-  }
-
-  return  TRUE;
-}
-
-
-static GeglRectangle
-get_defined_region (GeglOperation *operation)
-{
-  GeglRectangle result = {0,0,0,0};
-  GeglChantOperation    *self = GEGL_CHANT_OPERATION (operation);
-  /*GeglOperationSource *source = GEGL_OPERATION_SOURCE(operation);*/
-  gint width, height;
-  gint status;
-
-  /*if (!strcmp (self->path, "-"))
-    {
-      process (operation);
-      width = source->output->width;
-      height = source->output->height;
-    }
-  else*/
-    {
-      width  = self->width;
-      height = self->height;
-      status = query_svg (self->path, &width, &height);
-      if (status == FALSE)
-        {
-          g_warning ("get defined region of %s failed", self->path);
-          width = 0;
-          height = 0;
-        }
-    }
-
-  result.width  = width;
-  result.height  = height;
-  return result;
-}
-
-static gint
-gegl_buffer_import_svg (GeglBuffer  *gegl_buffer,
-                        const gchar *path,
-                        gint         width,
-                        gint         height,
-                        gint         dest_x,
-                        gint         dest_y,
-                        gint        *ret_width,
                         gint        *ret_height)
 {
     cairo_surface_t *surface;
@@ -241,18 +143,106 @@
   return TRUE;
 }
 
-static void class_init (GeglOperationClass *operation_class)
+static GeglRectangle
+get_defined_region (GeglOperation *operation)
 {
-  static gboolean done=FALSE;
+  GeglChantO   *o = GEGL_CHANT_PROPERTIES (operation);
+  GeglRectangle result = {0,0,0,0};
+  /*GeglOperationSource *source = GEGL_OPERATION_SOURCE(operation);*/
+  gint width, height;
+  gint status;
+
+  /*if (!strcmp (o->path, "-"))
+    {
+      process (operation);
+      width = source->output->width;
+      height = source->output->height;
+    }
+  else*/
+    {
+      width  = o->width;
+      height = o->height;
+      status = query_svg (o->path, &width, &height);
+      if (status == FALSE)
+        {
+          g_warning ("get defined region of %s failed", o->path);
+          width = 0;
+          height = 0;
+        }
+    }
+
+  result.width  = width;
+  result.height  = height;
+  return result;
+}
+
+static gboolean
+process (GeglOperation       *operation,
+         GeglNodeContext     *context,
+         GeglBuffer          *output,
+         const GeglRectangle *result_foo)
+{
+  GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+  gint        result;
+  gint        width, height;
+
+    width  = o->width;
+    height = o->height;
+    result = query_svg (o->path, &width, &height);
+    if (result == FALSE)
+      {
+        g_warning ("%s failed to open file %s for reading.",
+          G_OBJECT_TYPE_NAME (operation), o->path);
+          output = gegl_buffer_new (NULL, NULL);
+            return TRUE;
+      }
+
+      {
+        GeglRectangle extent={0,0,width,height};
+        /* FIXME: the format should be set on the pad prior to the actual
+         * load
+         */
+        output = gegl_buffer_new (&extent, babl_format ("R'G'B'A u8"));
+      }
+
+  result = gegl_buffer_import_svg (output, o->path,
+                                   width, height, 0, 0, &width, &height);
+  if (result)
+    {
+      g_warning ("%s failed to open file %s for reading.",
+        G_OBJECT_TYPE_NAME (operation), o->path);
+      return  FALSE;
+    }
+  gegl_node_context_set_object (context, "output", G_OBJECT (output));
+
+  return  TRUE;
+}
+
+
+static void
+operation_class_init (GeglChantClass *klass)
+{
+  GeglOperationClass       *operation_class;
+  GeglOperationSourceClass *source_class;
+
+  operation_class = GEGL_OPERATION_CLASS (klass);
+  source_class    = GEGL_OPERATION_SOURCE_CLASS (klass);
+
+  source_class->process = process;
+  operation_class->get_defined_region = get_defined_region;
 
-  if (done)
-    return;
+  operation_class->name        = "svg-load";
+  operation_class->categories  = "input";   /* not hidden because it has extra API */
+  operation_class->description = "Load an SVG file using librsvg";
 
+//  static gboolean done=FALSE;
+//  if (done)
+//    return;
   gegl_extension_handler_register (".svg", "svg-load");
   gegl_extension_handler_register (".SVG", "svg-load");
   gegl_extension_handler_register (".svgz", "svg-load");
   gegl_extension_handler_register (".SVGZ", "svg-load");
-  done = TRUE;
+//  done = TRUE;
 }
 
 #endif



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