gegl r1916 - in trunk: . operations operations/workshop



Author: kcozens
Date: Sun Jan 27 01:31:27 2008
New Revision: 1916
URL: http://svn.gnome.org/viewvc/gegl?rev=1916&view=rev

Log:
	* operations/Makefile-operations.am:
	* operations/workshop/box-max.c:
	* operations/workshop/box-min.c: Formatting changes.

	* operations/workshop/box-percentile.c:
	* operations/workshop/c2g.c:
	* operations/workshop/demosaic-bimedian.c:
	* operations/workshop/demosaic-simple.c:
	* operations/workshop/disc-percentile.c:
	* operations/workshop/grey.c:
	* operations/workshop/hstack.c:
	* operations/workshop/kuwahara.c:
	* operations/workshop/kuwahara-max.c:
	* operations/workshop/kuwahara-min.c:
	* operations/workshop/lens-correct.c:
	* operations/workshop/line-profile.c:
	* operations/workshop/mandelbrot.c:
	* operations/workshop/max-envelope.c:
	* operations/workshop/min-envelope.c:
	* operations/workshop/snn-percentile.c:
	* operations/workshop/stress.c: Updated to new chanting API.


Modified:
   trunk/ChangeLog
   trunk/operations/Makefile-operations.am
   trunk/operations/workshop/box-max.c
   trunk/operations/workshop/box-min.c
   trunk/operations/workshop/box-percentile.c
   trunk/operations/workshop/c2g.c
   trunk/operations/workshop/demosaic-bimedian.c
   trunk/operations/workshop/demosaic-simple.c
   trunk/operations/workshop/disc-percentile.c
   trunk/operations/workshop/grey.c
   trunk/operations/workshop/hstack.c
   trunk/operations/workshop/kuwahara-max.c
   trunk/operations/workshop/kuwahara-min.c
   trunk/operations/workshop/kuwahara.c
   trunk/operations/workshop/lens-correct.c
   trunk/operations/workshop/line-profile.c
   trunk/operations/workshop/mandelbrot.c
   trunk/operations/workshop/max-envelope.c
   trunk/operations/workshop/min-envelope.c
   trunk/operations/workshop/snn-percentile.c
   trunk/operations/workshop/stress.c

Modified: trunk/operations/Makefile-operations.am
==============================================================================
--- trunk/operations/Makefile-operations.am	(original)
+++ trunk/operations/Makefile-operations.am	Sun Jan 27 01:31:27 2008
@@ -14,7 +14,7 @@
 
 CFLAGS  += @DEP_CFLAGS@ @BABL_CFLAGS@ @CPPFLAGS@ \
            -I$(srcdir) -I$(top_srcdir)           \
-            -I$(top_srcdir)/gegl                 \
+           -I$(top_srcdir)/gegl                  \
            -I$(top_srcdir)/gegl/buffer           \
            -I$(top_srcdir)/gegl/operation        \
            -I$(top_srcdir)/gegl/property-types   \

Modified: trunk/operations/workshop/box-max.c
==============================================================================
--- trunk/operations/workshop/box-max.c	(original)
+++ trunk/operations/workshop/box-max.c	Sun Jan 27 01:31:27 2008
@@ -26,37 +26,9 @@
 #define GEGL_CHANT_C_FILE       "box-max.c"
 
 #include "gegl-chant.h"
-
-static void hor_max (GeglBuffer *src,
-                     GeglBuffer *dst,
-                     gint        radius);
-
-static void ver_max (GeglBuffer *src,
-                     GeglBuffer *dst,
-                     gint        radius);
-
+#include <math.h>
 #include <stdio.h>
 
-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 ("RGBA float"));
-
-  hor_max (input, temp,  o->radius);
-  ver_max (temp, output, o->radius);
-
-  g_object_unref (temp);
-
-  return  TRUE;
-}
-
 static inline gfloat
 get_max_component (gfloat *buf,
                    gint    buf_width,
@@ -169,7 +141,10 @@
   g_free (dst_buf);
 }
 
-#include <math.h>
+static void prepare (GeglOperation *operation)
+{
+  gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
+}
 
 static void tickle (GeglOperation *operation)
 {
@@ -179,27 +154,42 @@
       ceil (GEGL_CHANT_PROPERTIES (operation)->radius);
 }
 
-
-static void prepare (GeglOperation *operation)
+static gboolean
+process (GeglOperation       *operation,
+         GeglBuffer          *input,
+         GeglBuffer          *output,
+         const GeglRectangle *result)
 {
-  gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
+  GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+  GeglBuffer *temp;
+
+  temp = gegl_buffer_new (gegl_buffer_get_extent (input),
+                          babl_format ("RGBA float"));
+
+  hor_max (input, temp,  o->radius);
+  ver_max (temp, output, o->radius);
+
+  g_object_unref (temp);
+
+  return  TRUE;
 }
 
+
 static void
 operation_class_init (GeglChantClass *klass)
 {
   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->tickle  = tickle;
 
-  operation_class->name       = "box-max";
-  operation_class->categories = "misc";
+  operation_class->name        = "box-max";
+  operation_class->categories  = "misc";
   operation_class->description =
         "Sets the target pixel to the value of the maximum value in a box surrounding the pixel.";
 }

Modified: trunk/operations/workshop/box-min.c
==============================================================================
--- trunk/operations/workshop/box-min.c	(original)
+++ trunk/operations/workshop/box-min.c	Sun Jan 27 01:31:27 2008
@@ -26,37 +26,8 @@
 #define GEGL_CHANT_C_FILE       "box-min.c"
 
 #include "gegl-chant.h"
-
-static void hor_min (GeglBuffer *src,
-                     GeglBuffer *dst,
-                     gint        radius);
-
-static void ver_min (GeglBuffer *src,
-                     GeglBuffer *dst,
-                     gint        radius);
-
 #include <stdio.h>
-
-
-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 ("RGBA float"));
-
-  hor_min (input, temp,  o->radius);
-  ver_min (temp, output, o->radius);
-
-  g_object_unref (temp);
-
-  return  TRUE;
-}
+#include <math.h>
 
 static inline gfloat
 get_min_component (gfloat *buf,
@@ -170,7 +141,10 @@
   g_free (dst_buf);
 }
 
-#include <math.h>
+static void prepare (GeglOperation *operation)
+{
+  gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
+}
 
 static void tickle (GeglOperation *operation)
 {
@@ -182,27 +156,42 @@
   area->bottom = GEGL_CHANT_PROPERTIES (operation)->radius;
 }
 
-
-static void prepare (GeglOperation *operation)
+static gboolean
+process (GeglOperation       *operation,
+         GeglBuffer          *input,
+         GeglBuffer          *output,
+         const GeglRectangle *result)
 {
-  gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
+  GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+  GeglBuffer *temp;
+
+  temp = gegl_buffer_new (gegl_buffer_get_extent (input),
+                          babl_format ("RGBA float"));
+
+  hor_min (input, temp,  o->radius);
+  ver_min (temp, output, o->radius);
+
+  g_object_unref (temp);
+
+  return  TRUE;
 }
 
+
 static void
 operation_class_init (GeglChantClass *klass)
 {
   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->tickle  = tickle;
 
-  operation_class->name       = "box-min";
-  operation_class->categories = "misc";
+  operation_class->name        = "box-min";
+  operation_class->categories  = "misc";
   operation_class->description =
         "Sets the target pixel to the value of the minimum value in a box surrounding the pixel.";
 }

Modified: trunk/operations/workshop/box-percentile.c
==============================================================================
--- trunk/operations/workshop/box-percentile.c	(original)
+++ trunk/operations/workshop/box-percentile.c	Sun Jan 27 01:31:27 2008
@@ -17,8 +17,7 @@
  *           2007 Ãyvind KolÃs <oeyvindk hig no>
  */
 
-#if GEGL_CHANT_PROPERTIES
-#define MAX_SAMPLES 20000 /* adapted to max level of radius */
+#ifdef GEGL_CHANT_PROPERTIES
 
 gegl_chant_double (radius, 0.0, 70.0, 4.0,
   "Radius of square pixel region, (width and height will be radius*2+1.")
@@ -26,55 +25,53 @@
 
 #else
 
-#define GEGL_CHANT_NAME            box_percentile
-#define GEGL_CHANT_SELF            "box-percentile.c"
-#define GEGL_CHANT_DESCRIPTION     "Sets the target pixel to the color corresponding to a given percentile when colors are sorted by luminance."
-#define GEGL_CHANT_CATEGORIES      "misc"
+#define MAX_SAMPLES 20000 /* adapted to max level of radius */
 
-#define GEGL_CHANT_AREA_FILTER
-#define GEGL_CHANT_PREPARE
+#define GEGL_CHANT_TYPE_AREA_FILTER
+#define GEGL_CHANT_C_FILE       "box-percentile.c"
 
-#include "gegl-old-chant.h"
+#include "gegl-chant.h"
+#include <stdio.h>
+#include <math.h>
 
 static void median (GeglBuffer *src,
                     GeglBuffer *dst,
                     gint        radius,
                     gdouble     rank);
 
-#include <stdio.h>
 
 static void prepare (GeglOperation *operation)
 {
   gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
 }
 
+static void tickle (GeglOperation *operation)
+{
+  GeglOperationAreaFilter *area = GEGL_OPERATION_AREA_FILTER (operation);
+  GeglChantO              *o = GEGL_CHANT_PROPERTIES (operation);
+  area->left = area->right = area->top = area->bottom = ceil (o->radius);
+}
+
 static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
          GeglBuffer          *output,
          const GeglRectangle *result)
 {
-  GeglOperationFilter *filter;
-  GeglChantOperation  *self;
-
-  filter = GEGL_OPERATION_FILTER (operation);
-  self   = GEGL_CHANT_OPERATION (operation);
+  GeglChantO   *o = GEGL_CHANT_PROPERTIES (operation);
+  GeglBuffer   *temp_in;
+  GeglRectangle compute = gegl_operation_compute_input_request (operation, "input", result);
 
+  if (o->radius < 1.0)
     {
-      GeglBuffer      *temp_in;
-      GeglRectangle compute  = gegl_operation_compute_input_request (operation, "input", result);
-
-      if (self->radius < 1.0)
-        {
-          output = g_object_ref (input);
-        }
-      else
-        {
-          temp_in = gegl_buffer_create_sub_buffer (input, &compute);
+      output = g_object_ref (input);
+    }
+  else
+    {
+      temp_in = gegl_buffer_create_sub_buffer (input, &compute);
 
-          median (temp_in, output, self->radius, self->percentile / 100.0);
-          g_object_unref (temp_in);
-        }
+      median (temp_in, output, o->radius, o->percentile / 100.0);
+      g_object_unref (temp_in);
     }
 
   return  TRUE;
@@ -208,14 +205,24 @@
   g_free (dst_buf);
 }
 
-#include <math.h>
 
-static void tickle (GeglOperation *operation)
+static void
+operation_class_init (GeglChantClass *klass)
 {
-  GeglOperationAreaFilter *area = GEGL_OPERATION_AREA_FILTER (operation);
-  GeglChantOperation      *filter = GEGL_CHANT_OPERATION (operation);
-  area->left = area->right = area->top = area->bottom =
-      ceil (filter->radius);
+  GeglOperationClass       *operation_class;
+  GeglOperationFilterClass *filter_class;
+
+  operation_class = GEGL_OPERATION_CLASS (klass);
+  filter_class    = GEGL_OPERATION_FILTER_CLASS (klass);
+
+  filter_class->process = process;
+  operation_class->prepare = prepare;
+  operation_class->tickle  = tickle;
+
+  operation_class->name        = "box-percentile";
+  operation_class->categories  = "misc";
+  operation_class->description =
+        "Sets the target pixel to the color corresponding to a given percentile when colors are sorted by luminance.";
 }
 
 #endif

Modified: trunk/operations/workshop/c2g.c
==============================================================================
--- trunk/operations/workshop/c2g.c	(original)
+++ trunk/operations/workshop/c2g.c	Sun Jan 27 01:31:27 2008
@@ -17,7 +17,7 @@
  *                Ivar Farup   <ivarf hig no>
  */
 
-#if GEGL_CHANT_PROPERTIES
+#ifdef GEGL_CHANT_PROPERTIES
 
 gegl_chant_int (radius,     2, 5000.0, 384, "neighbourhood taken into account")
 gegl_chant_int (samples,    0, 1000,    3,  "number of samples to do")
@@ -26,18 +26,17 @@
 gegl_chant_double (rgamma, 0.0, 8.0, 1.8, "gamma applied to radial distribution")
 gegl_chant_double (strength,  -8, 8,  0.5, "how much the local optimum separation should be taken into account.")
 gegl_chant_double (gamma, 0.0, 10.0, 1.6, "post correction gamma.")
-#else
 
-#define GEGL_CHANT_NAME         c2g
-#define GEGL_CHANT_SELF         "c2g.c"
-#define GEGL_CHANT_DESCRIPTION  "Color to grayscale conversion that uses, spatial color differences to perform local grayscale contrast enhancement."
-#define GEGL_CHANT_CATEGORIES   "enhance"
+#else
 
-#define GEGL_CHANT_AREA_FILTER
-#define GEGL_CHANT_PREPARE
+#define GEGL_CHANT_TYPE_AREA_FILTER
+#define GEGL_CHANT_C_FILE       "c2g.c"
 
-#include "gegl-old-chant.h"
+#include "gegl-chant.h"
 #include <math.h>
+#include <stdlib.h>
+#include "envelopes.h"
+
 #define sq(a) ((a)*(a))
 
 static void c2g (GeglBuffer *src,
@@ -50,40 +49,37 @@
                  gfloat      strength,
                  gfloat      gamma);
 
-#include <stdlib.h>
-
 static void prepare (GeglOperation *operation)
 {
   gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
 }
 
+static void tickle (GeglOperation *operation)
+{
+  GeglOperationAreaFilter *area = GEGL_OPERATION_AREA_FILTER (operation);
+  GeglChantO              *o = GEGL_CHANT_PROPERTIES (operation);
+  area->left = area->right = area->top = area->bottom = ceil (o->radius);
+}
+
 static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
          GeglBuffer          *output,
          const GeglRectangle *result)
 {
-  GeglOperationFilter *filter;
-  GeglChantOperation  *self;
-
-  filter = GEGL_OPERATION_FILTER (operation);
-  self   = GEGL_CHANT_OPERATION (operation);
-
-  {
-    GeglBuffer      *temp_in;
-    GeglRectangle    compute  = gegl_operation_compute_input_request (operation, "input", result);
-
-    temp_in = gegl_buffer_create_sub_buffer (input, &compute);
-
-    c2g (temp_in, output, self->radius, self->samples, self->iterations, self->same_spray, self->rgamma, self->strength, self->gamma);
-    g_object_unref (temp_in);
-  }
+  GeglChantO   *o = GEGL_CHANT_PROPERTIES (operation);
+  GeglBuffer   *temp_in;
+  GeglRectangle compute = gegl_operation_compute_input_request (operation, "input", result);
+
+  temp_in = gegl_buffer_create_sub_buffer (input, &compute);
+
+  c2g (temp_in, output, o->radius, o->samples, o->iterations, o->same_spray,
+       o->rgamma, o->strength, o->gamma);
+  g_object_unref (temp_in);
 
   return  TRUE;
 }
 
-#include "envelopes.h"
-
 static void c2g (GeglBuffer *src,
                  GeglBuffer *dst,
                  gint        radius,
@@ -98,7 +94,6 @@
   gfloat *src_buf;
   gfloat *dst_buf;
 
-
   src_buf = g_malloc0 (gegl_buffer_get_pixel_count (src) * 4 * 4);
   dst_buf = g_malloc0 (gegl_buffer_get_pixel_count (dst) * 4 * 4);
 
@@ -167,12 +162,24 @@
   g_free (dst_buf);
 }
 
-static void tickle (GeglOperation *operation)
+
+static void
+operation_class_init (GeglChantClass *klass)
 {
-  GeglOperationAreaFilter *area = GEGL_OPERATION_AREA_FILTER (operation);
-  GeglChantOperation      *filter = GEGL_CHANT_OPERATION (operation);
-  area->left = area->right = area->top = area->bottom =
-      ceil (filter->radius);
+  GeglOperationClass       *operation_class;
+  GeglOperationFilterClass *filter_class;
+
+  operation_class = GEGL_OPERATION_CLASS (klass);
+  filter_class    = GEGL_OPERATION_FILTER_CLASS (klass);
+
+  filter_class->process = process;
+  operation_class->prepare = prepare;
+  operation_class->tickle = tickle;
+
+  operation_class->name        = "c2g";
+  operation_class->categories  = "enhance";
+  operation_class->description =
+        "Color to grayscale conversion that uses, spatial color differences to perform local grayscale contrast enhancement.";
 }
 
 #endif

Modified: trunk/operations/workshop/demosaic-bimedian.c
==============================================================================
--- trunk/operations/workshop/demosaic-bimedian.c	(original)
+++ trunk/operations/workshop/demosaic-bimedian.c	Sun Jan 27 01:31:27 2008
@@ -16,38 +16,17 @@
  * Copyright 2006 Ãyvind KolÃs <pippin gimp org>
  * Copyright 2008 Bradley Broom <bmbroom gmail com>
  */
-#if GEGL_CHANT_PROPERTIES
+#ifdef GEGL_CHANT_PROPERTIES
 
 gegl_chant_int (pattern, 0, 3, 0, "Bayer pattern used, 0 seems to work for some nikon files, 2 for some Fuji files.")
- 
-#else
-
-#define GEGL_CHANT_NAME            demosaic_bimedian
-#define GEGL_CHANT_SELF            "demosaic-bimedian.c"
-#define GEGL_CHANT_DESCRIPTION     "Performs a grayscale2color demosaicing of an image, using bimedian interpolation."
-#define GEGL_CHANT_CATEGORIES      "blur"
-
-#define GEGL_CHANT_AREA_FILTER
 
-#include "gegl-old-chant.h"
-
-static void
-demosaic (GeglChantOperation *op,
-          GeglBuffer *src,
-          GeglBuffer *dst);
+#else
 
-static gboolean
-process (GeglOperation       *operation,
-         GeglBuffer          *input,
-         GeglBuffer          *output,
-         const GeglRectangle *result)
-{
-  GeglChantOperation  *self = GEGL_CHANT_OPERATION (operation);
+#define GEGL_CHANT_TYPE_AREA_FILTER
+#define GEGL_CHANT_C_FILE       "demosaic-bimedian.c"
 
-  demosaic (self, input, output);
+#include "gegl-chant.h"
 
-  return  TRUE;
-}
 
 /* Returns the median of four floats. We define the median as the average of
  * the central two elements.
@@ -70,12 +49,12 @@
       t = c;
       c = b;
       if (a > t)
-	{
-	  b = a;
-	  a = t;
-	}
+        {
+          b = a;
+          a = t;
+        }
       else
-	b = t;
+    b = t;
     }
   /* Return average of central two elements. */
   if (d >= c) /* Sorted order would be abcd */
@@ -94,7 +73,7 @@
  * of dst_extent.
  */
 static void
-demosaic (GeglChantOperation *op,
+demosaic (GeglChantO *op,
           GeglBuffer *src,
           GeglBuffer *dst)
 {
@@ -107,78 +86,78 @@
 
   src_buf = g_malloc0 (gegl_buffer_get_pixel_count (src) * 4);
   dst_buf = g_malloc0 (gegl_buffer_get_pixel_count (dst) * 4 * 3);
-  
+
   gegl_buffer_get (src, 1.0, NULL, babl_format ("Y float"), src_buf,
-  		   GEGL_AUTO_ROWSTRIDE);
+           GEGL_AUTO_ROWSTRIDE);
 
   offset = ROW + COL;
   doffset = 0;
   for (y=dst_extent->y; y<dst_extent->height + dst_extent->y; y++)
     {
       for (x=dst_extent->x; x<dst_extent->width + dst_extent->x; x++)
-	{
-	  gfloat red=0.0;
-	  gfloat green=0.0;
-	  gfloat blue=0.0;
-
-	  if ((y + op->pattern%2)%2==0)
-	    {
-	      if ((x+op->pattern/2)%2==1)
-		{
-		  /* GRG
-		   * BGB
-		   * GRG
-		   */
-		  blue =(src_buf[offset-COL]+src_buf[offset+COL])/2.0;
-		  green=src_buf[offset];
-		  red  =(src_buf[offset-ROW]+src_buf[offset+ROW])/2.0;
-		}
-	      else
-		{
-		  /* RGR
-		   * GBG
-		   * RGR
-		   */
-		  blue =src_buf[offset];
-		  green=m4(src_buf[offset-ROW], src_buf[offset-COL],
-		           src_buf[offset+COL], src_buf[offset+ROW]);
-		  red  =m4(src_buf[offset-ROW-COL], src_buf[offset-ROW+COL],
-		           src_buf[offset+ROW-COL], src_buf[offset+ROW+COL]);
-		}
-	    }
-	  else
-	    {
-	      if ((x+op->pattern/2)%2==1)
-		{
-		  /* BGB
-		   * GRG
-		   * BGB
-		   */
-		  blue =m4(src_buf[offset-ROW-COL], src_buf[offset-ROW+COL],
-		  	   src_buf[offset+ROW-COL], src_buf[offset+ROW+COL]);
-		  green=m4(src_buf[offset-ROW], src_buf[offset-COL],
-		  	   src_buf[offset+COL], src_buf[offset+ROW]);
-		  red  =src_buf[offset];
-		}
-	      else
-		{
-		  /* GBG
-		   * RGR
-		   * GBG
-		   */
-		  blue =(src_buf[offset-ROW]+src_buf[offset+ROW])/2.0;
-		  green=src_buf[offset];
-		  red  =(src_buf[offset-COL]+src_buf[offset+COL])/2.0;
-		}
-	    }
-	  
-	  dst_buf [doffset*3+0] = red;
-	  dst_buf [doffset*3+1] = green;
-	  dst_buf [doffset*3+2] = blue;
-
-	  offset++;
-	  doffset++;
-	}
+        {
+          gfloat red=0.0;
+          gfloat green=0.0;
+          gfloat blue=0.0;
+
+          if ((y + op->pattern%2)%2==0)
+            {
+              if ((x+op->pattern/2)%2==1)
+                {
+                  /* GRG
+                   * BGB
+                   * GRG
+                   */
+                  blue =(src_buf[offset-COL]+src_buf[offset+COL])/2.0;
+                  green=src_buf[offset];
+                  red  =(src_buf[offset-ROW]+src_buf[offset+ROW])/2.0;
+                }
+              else
+                {
+                  /* RGR
+                   * GBG
+                   * RGR
+                   */
+                  blue =src_buf[offset];
+                  green=m4(src_buf[offset-ROW], src_buf[offset-COL],
+                           src_buf[offset+COL], src_buf[offset+ROW]);
+                  red  =m4(src_buf[offset-ROW-COL], src_buf[offset-ROW+COL],
+                           src_buf[offset+ROW-COL], src_buf[offset+ROW+COL]);
+                }
+            }
+          else
+            {
+              if ((x+op->pattern/2)%2==1)
+                {
+                  /* BGB
+                   * GRG
+                   * BGB
+                   */
+                  blue =m4(src_buf[offset-ROW-COL], src_buf[offset-ROW+COL],
+                       src_buf[offset+ROW-COL], src_buf[offset+ROW+COL]);
+                  green=m4(src_buf[offset-ROW], src_buf[offset-COL],
+                       src_buf[offset+COL], src_buf[offset+ROW]);
+                  red  =src_buf[offset];
+                }
+              else
+                {
+                  /* GBG
+                   * RGR
+                   * GBG
+                   */
+                  blue =(src_buf[offset-ROW]+src_buf[offset+ROW])/2.0;
+                  green=src_buf[offset];
+                  red  =(src_buf[offset-COL]+src_buf[offset+COL])/2.0;
+                }
+            }
+
+          dst_buf [doffset*3+0] = red;
+          dst_buf [doffset*3+1] = green;
+          dst_buf [doffset*3+2] = blue;
+
+          offset++;
+          doffset++;
+        }
       offset+=2;
     }
 
@@ -196,4 +175,36 @@
   area->left = area->top = 1;
 }
 
+static gboolean
+process (GeglOperation       *operation,
+         GeglBuffer          *input,
+         GeglBuffer          *output,
+         const GeglRectangle *result)
+{
+  GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+
+  demosaic (o, input, output);
+
+  return  TRUE;
+}
+
+
+static void
+operation_class_init (GeglChantClass *klass)
+{
+  GeglOperationClass       *operation_class;
+  GeglOperationFilterClass *filter_class;
+
+  operation_class = GEGL_OPERATION_CLASS (klass);
+  filter_class    = GEGL_OPERATION_FILTER_CLASS (klass);
+
+  filter_class->process = process;
+  operation_class->tickle = tickle;
+
+  operation_class->name        = "demosaic-bimedian";
+  operation_class->categories  = "blur";
+  operation_class->description =
+        "Performs a grayscale2color demosaicing of an image, using bimedian interpolation.";
+}
+
 #endif

Modified: trunk/operations/workshop/demosaic-simple.c
==============================================================================
--- trunk/operations/workshop/demosaic-simple.c	(original)
+++ trunk/operations/workshop/demosaic-simple.c	Sun Jan 27 01:31:27 2008
@@ -15,60 +15,19 @@
  *
  * Copyright 2006 Ãyvind KolÃs <pippin gimp org>
  */
-#if GEGL_CHANT_PROPERTIES
+#ifdef GEGL_CHANT_PROPERTIES
 
 gegl_chant_int (pattern, 0, 3, 0, "Bayer pattern used, 0 seems to work for some nikon files, 2 for some Fuji files.")
 
 #else
 
-#define GEGL_CHANT_NAME            demosaic_simple
-#define GEGL_CHANT_SELF            "demosaic-simple.c"
-#define GEGL_CHANT_DESCRIPTION     "Performs a naive grayscale2color demosaicing of an image, no interpolation."
-#define GEGL_CHANT_CATEGORIES      "blur"
+#define GEGL_CHANT_TYPE_AREA_FILTER
+#define GEGL_CHANT_C_FILE       "demosaic-simple.c"
 
-#define GEGL_CHANT_AREA_FILTER
-#define GEGL_CHANT_PREPARE
-
-#include "gegl-old-chant.h"
-
-static void
-demosaic (GeglChantOperation *op,
-          GeglBuffer *src,
-          GeglBuffer *dst);
-
-static void prepare (GeglOperation *operation)
-{
-  gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
-}
-
-static gboolean
-process (GeglOperation       *operation,
-         GeglBuffer          *input,
-         GeglBuffer          *output,
-         const GeglRectangle *result)
-{
-  GeglOperationFilter *filter;
-  GeglChantOperation  *self;
-
-  filter = GEGL_OPERATION_FILTER (operation);
-  self   = GEGL_CHANT_OPERATION (operation);
-
-    {
-      GeglBuffer    *temp_in;
-      GeglRectangle    compute  = gegl_operation_compute_input_request (operation, "input", result);
-
-
-      temp_in = gegl_buffer_create_sub_buffer (input, &compute);
-
-      demosaic (self, temp_in, output);
-      g_object_unref (temp_in);
-    }
-
-  return  TRUE;
-}
+#include "gegl-chant.h"
 
 static void
-demosaic (GeglChantOperation *op,
+demosaic (GeglChantO *op,
           GeglBuffer *src,
           GeglBuffer *dst)
 {
@@ -139,10 +98,53 @@
   g_free (dst_buf);
 }
 
+static void prepare (GeglOperation *operation)
+{
+  gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
+}
+
 static void tickle (GeglOperation *operation)
 {
   GeglOperationAreaFilter *area = GEGL_OPERATION_AREA_FILTER (operation);
   area->right = area->bottom = 1;
 }
 
+static gboolean
+process (GeglOperation       *operation,
+         GeglBuffer          *input,
+         GeglBuffer          *output,
+         const GeglRectangle *result)
+{
+  GeglChantO   *o = GEGL_CHANT_PROPERTIES (operation);
+  GeglBuffer   *temp_in;
+  GeglRectangle compute = gegl_operation_compute_input_request (operation, "input", result);
+
+  temp_in = gegl_buffer_create_sub_buffer (input, &compute);
+
+  demosaic (o, temp_in, output);
+
+  g_object_unref (temp_in);
+
+  return  TRUE;
+}
+
+
+static void
+operation_class_init (GeglChantClass *klass)
+{
+  GeglOperationClass       *operation_class;
+  GeglOperationFilterClass *filter_class;
+
+  operation_class = GEGL_OPERATION_CLASS (klass);
+  filter_class    = GEGL_OPERATION_FILTER_CLASS (klass);
+
+  filter_class->process = process;
+  operation_class->prepare = prepare;
+  operation_class->tickle = tickle;
+
+  operation_class->name        = "demosaic-simple";
+  operation_class->categories  = "blur";
+  operation_class->description =
+        "Performs a naive grayscale2color demosaicing of an image, no interpolation.";
+}
 #endif

Modified: trunk/operations/workshop/disc-percentile.c
==============================================================================
--- trunk/operations/workshop/disc-percentile.c	(original)
+++ trunk/operations/workshop/disc-percentile.c	Sun Jan 27 01:31:27 2008
@@ -16,9 +16,7 @@
  * Copyright 2005 Ãyvind KolÃs <pippin gimp org>,
  *           2007 Ãyvind KolÃs <oeyvindk hig no>
  */
-#if GEGL_CHANT_PROPERTIES
-
-#define MAX_SAMPLES 20000 /* adapted to max level of radius */
+#ifdef GEGL_CHANT_PROPERTIES
 
 gegl_chant_double (radius, 0.0, 70.0, 4.0,
   "Radius of square pixel region, (width and height will be radius*2+1.")
@@ -26,15 +24,12 @@
 
 #else
 
-#define GEGL_CHANT_NAME            disc_percentile
-#define GEGL_CHANT_SELF            "disc-percentile.c"
-#define GEGL_CHANT_DESCRIPTION     "Sets the target pixel to the color corresponding to a given percentile when colors are sorted by luminance."
-#define GEGL_CHANT_CATEGORIES      "misc"
+#define MAX_SAMPLES 20000 /* adapted to max level of radius */
 
-#define GEGL_CHANT_AREA_FILTER
-#define GEGL_CHANT_PREPARE
+#define GEGL_CHANT_TYPE_AREA_FILTER
+#define GEGL_CHANT_C_FILE       "disc-percentile.c"
 
-#include "gegl-old-chant.h"
+#include "gegl-chant.h"
 #include <math.h>
 
 static void median (GeglBuffer *src,
@@ -44,44 +39,6 @@
 
 #include <stdio.h>
 
-static void prepare (GeglOperation *operation)
-{
-  gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
-}
-
-static gboolean
-process (GeglOperation       *operation,
-         GeglBuffer          *input,
-         GeglBuffer          *output,
-         const GeglRectangle *result)
-{
-  GeglOperationFilter *filter;
-  GeglChantOperation  *self;
-
-  filter = GEGL_OPERATION_FILTER (operation);
-  self   = GEGL_CHANT_OPERATION (operation);
-
-    {
-      GeglBuffer      *temp_in;
-      GeglRectangle    compute  = gegl_operation_compute_input_request (operation, "input", result);
-
-      if (self->radius < 1.0)
-        {
-          output = g_object_ref (input);
-        }
-      else
-        {
-          temp_in = gegl_buffer_create_sub_buffer (input, &compute);
-
-          median (temp_in, output, self->radius, self->percentile / 100.0);
-          g_object_unref (temp_in);
-        }
-    }
-
-  return  TRUE;
-}
-
-
 typedef struct
 {
   int       head;
@@ -215,13 +172,64 @@
   g_free (dst_buf);
 }
 
+
+static void prepare (GeglOperation *operation)
+{
+  gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
+}
+
 static void tickle (GeglOperation *operation)
 {
   GeglOperationAreaFilter *area = GEGL_OPERATION_AREA_FILTER (operation);
-  GeglChantOperation      *filter = GEGL_CHANT_OPERATION (operation);
-  area->left = area->right = area->top = area->bottom =
-      ceil (filter->radius);
+  GeglChantO              *o = GEGL_CHANT_PROPERTIES (operation);
+  area->left = area->right = area->top = 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_in;
+  GeglRectangle compute =
+        gegl_operation_compute_input_request (operation, "input", result);
+
+  if (o->radius < 1.0)
+    {
+      output = g_object_ref (input);
+    }
+  else
+    {
+      temp_in = gegl_buffer_create_sub_buffer (input, &compute);
+
+      median (temp_in, output, o->radius, o->percentile / 100.0);
+      g_object_unref (temp_in);
+    }
+
+  return  TRUE;
+}
+
+
+static void
+operation_class_init (GeglChantClass *klass)
+{
+  GeglOperationClass       *operation_class;
+  GeglOperationFilterClass *filter_class;
+
+  operation_class = GEGL_OPERATION_CLASS (klass);
+  filter_class    = GEGL_OPERATION_FILTER_CLASS (klass);
+
+  filter_class->process = process;
+  operation_class->prepare = prepare;
+  operation_class->tickle  = tickle;
+
+  operation_class->name        = "disc-percentile";
+  operation_class->categories  = "misc";
+  operation_class->description =
+        "Sets the target pixel to the color corresponding to a given"
+        " percentile when colors are sorted by luminance.";
+}
 
 #endif

Modified: trunk/operations/workshop/grey.c
==============================================================================
--- trunk/operations/workshop/grey.c	(original)
+++ trunk/operations/workshop/grey.c	Sun Jan 27 01:31:27 2008
@@ -15,19 +15,16 @@
  *
  * Copyright 2006 Ãyvind KolÃs <pippin gimp org>
  */
-#if GEGL_CHANT_PROPERTIES
+#ifdef GEGL_CHANT_PROPERTIES
+
    /* no properties */
-#else
 
-#define GEGL_CHANT_NAME          grey
-#define GEGL_CHANT_SELF          "grey.c"
-#define GEGL_CHANT_DESCRIPTION   "turns the image greyscale"
-#define GEGL_CHANT_CATEGORIES    "color"
+#else
 
-#define GEGL_CHANT_POINT_FILTER
-#define GEGL_CHANT_PREPARE
+#define GEGL_CHANT_TYPE_POINT_FILTER
+#define GEGL_CHANT_C_FILE       "grey.c"
 
-#include "gegl-old-chant.h"
+#include "gegl-chant.h"
 
 static void prepare (GeglOperation *operation)
 {
@@ -41,9 +38,27 @@
 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;
+  GeglOperationFilterClass *filter_class;
+
+  operation_class = GEGL_OPERATION_CLASS (klass);
+  filter_class    = GEGL_OPERATION_FILTER_CLASS (klass);
+
+  filter_class->process = process;
+  operation_class->prepare = prepare;
+
+  operation_class->name        = "grey";
+  operation_class->categories  = "color";
+  operation_class->description = "Turns the image greyscale";
+}
+
 #endif

Modified: trunk/operations/workshop/hstack.c
==============================================================================
--- trunk/operations/workshop/hstack.c	(original)
+++ trunk/operations/workshop/hstack.c	Sun Jan 27 01:31:27 2008
@@ -16,20 +16,16 @@
  * Copyright 2007 Ãyvind KolÃs <oeyvindk hig no>
  */
 
-#if GEGL_CHANT_PROPERTIES
+#ifdef GEGL_CHANT_PROPERTIES
+
+    /* No properties */
 
 #else
 
-#define GEGL_CHANT_NAME        hstack
-#define GEGL_CHANT_SELF        "hstack.c"
-#define GEGL_CHANT_DESCRIPTION "Horizontally stack inputs, (in \"output\" \"aux\" is placed to the right of \"input\")"
-#define GEGL_CHANT_CATEGORIES  "misc"
-
-#define GEGL_CHANT_COMPOSER
-#define GEGL_CHANT_CLASS_INIT
-#define GEGL_CHANT_PREPARE
+#define GEGL_CHANT_TYPE_COMPOSER
+//#define GEGL_CHANT_C_FILE       "hstack.c"
 
-#include "gegl-old-chant.h"
+#include "gegl-chant.h"
 #include <math.h>
 
 static void prepare (GeglOperation *operation)
@@ -37,60 +33,6 @@
   gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
 }
 
-static gboolean
-process (GeglOperation       *operation,
-         GeglBuffer          *input,
-         GeglBuffer          *aux,
-         GeglBuffer          *output,
-         const GeglRectangle *result)
-{
-  GeglOperationComposer *composer;
-  GeglBuffer            *temp_in;
-  GeglBuffer            *temp_aux;
-
-  composer = GEGL_OPERATION_COMPOSER (operation);
-
-  /* FIXME: just pass the originals buffers if the result rectangle does not
-   * include both input buffers
-   */
-
-  temp_in = gegl_buffer_create_sub_buffer (input, result);
-  temp_aux = gegl_buffer_create_sub_buffer (aux, result);
-
-    {
-      gfloat *buf = g_malloc0 (result->width * result->height * 4 * 4);
-      gfloat *bufB = g_malloc0 (result->width * result->height * 4 * 4);
-
-      gegl_buffer_get (temp_in, 1.0, NULL, babl_format ("RGBA float"), buf, GEGL_AUTO_ROWSTRIDE);
-      gegl_buffer_get (temp_aux, 1.0, NULL, babl_format ("RGBA float"), bufB, GEGL_AUTO_ROWSTRIDE);
-        {
-          gint offset=0;
-          gint x,y;
-          for (y=0;y<gegl_buffer_get_height (output);y++)
-            for (x=0;x<gegl_buffer_get_width (output);x++)
-              {
-                if (x + result->x >= gegl_buffer_get_width (input))
-                  {
-                    buf[offset+0]=bufB[offset+0];
-                    buf[offset+1]=bufB[offset+1];
-                    buf[offset+2]=bufB[offset+2];
-                    buf[offset+3]=bufB[offset+3];
-                  }
-                offset+=4;
-              }
-        }
-      gegl_buffer_set (output, NULL, babl_format ("RGBA float"), buf,
-                       GEGL_AUTO_ROWSTRIDE);
-
-      g_free (buf);
-      g_free (bufB);
-    }
-  g_object_unref (temp_in);
-  g_object_unref (temp_aux);
-
-  return  TRUE;
-}
-
 static GeglRectangle
 get_defined_region (GeglOperation *operation)
 {
@@ -155,11 +97,80 @@
   return *region;
 }
 
-static void class_init (GeglOperationClass *operation_class)
+static gboolean
+process (GeglOperation       *operation,
+         GeglBuffer          *input,
+         GeglBuffer          *aux,
+         GeglBuffer          *output,
+         const GeglRectangle *result)
+{
+  GeglOperationComposer *composer;
+  GeglBuffer            *temp_in;
+  GeglBuffer            *temp_aux;
+
+  composer = GEGL_OPERATION_COMPOSER (operation);
+
+  /* FIXME: just pass the originals buffers if the result rectangle does not
+   * include both input buffers
+   */
+
+  temp_in = gegl_buffer_create_sub_buffer (input, result);
+  temp_aux = gegl_buffer_create_sub_buffer (aux, result);
+
+    {
+      gfloat *buf = g_malloc0 (result->width * result->height * 4 * 4);
+      gfloat *bufB = g_malloc0 (result->width * result->height * 4 * 4);
+
+      gegl_buffer_get (temp_in, 1.0, NULL, babl_format ("RGBA float"), buf, GEGL_AUTO_ROWSTRIDE);
+      gegl_buffer_get (temp_aux, 1.0, NULL, babl_format ("RGBA float"), bufB, GEGL_AUTO_ROWSTRIDE);
+        {
+          gint offset=0;
+          gint x,y;
+          for (y=0;y<gegl_buffer_get_height (output);y++)
+            for (x=0;x<gegl_buffer_get_width (output);x++)
+              {
+                if (x + result->x >= gegl_buffer_get_width (input))
+                  {
+                    buf[offset+0]=bufB[offset+0];
+                    buf[offset+1]=bufB[offset+1];
+                    buf[offset+2]=bufB[offset+2];
+                    buf[offset+3]=bufB[offset+3];
+                  }
+                offset+=4;
+              }
+        }
+      gegl_buffer_set (output, NULL, babl_format ("RGBA float"), buf,
+                       GEGL_AUTO_ROWSTRIDE);
+
+      g_free (buf);
+      g_free (bufB);
+    }
+  g_object_unref (temp_in);
+  g_object_unref (temp_aux);
+
+  return  TRUE;
+}
+
+
+static void
+operation_class_init (GeglChantClass *klass)
 {
-  operation_class->get_defined_region      = get_defined_region;
+  GeglOperationClass         *operation_class;
+  GeglOperationComposerClass *composer_class;
+
+  operation_class = GEGL_OPERATION_CLASS (klass);
+  composer_class  = GEGL_OPERATION_COMPOSER_CLASS (klass);
+
+  composer_class->process = process;
+  operation_class->prepare = prepare;
+  operation_class->get_defined_region = get_defined_region;
   operation_class->compute_affected_region = compute_affected_region;
   operation_class->compute_input_request   = compute_input_request;
+
+  operation_class->name        = "hstack";
+  operation_class->categories  = "misc";
+  operation_class->description =
+        "Horizontally stack inputs, (in \"output\" \"aux\" is placed to the right of \"input\")";
 }
 
 #endif

Modified: trunk/operations/workshop/kuwahara-max.c
==============================================================================
--- trunk/operations/workshop/kuwahara-max.c	(original)
+++ trunk/operations/workshop/kuwahara-max.c	Sun Jan 27 01:31:27 2008
@@ -15,59 +15,19 @@
  *
  * Copyright 2006 Ãyvind KolÃs <pippin gimp org>
  */
-#if GEGL_CHANT_PROPERTIES
+#ifdef GEGL_CHANT_PROPERTIES
 
 gegl_chant_double (radius, 0.0, 50.0, 4.0,
   "Radius of square pixel region, (width and height will be radius*2+1.")
 
 #else
 
-#define GEGL_CHANT_NAME            kuwahara_max
-#define GEGL_CHANT_SELF            "kuwahara-max.c"
-#define GEGL_CHANT_DESCRIPTION     "Edge preserving max filter"
-#define GEGL_CHANT_CATEGORIES      "misc"
+#define GEGL_CHANT_TYPE_AREA_FILTER
+#define GEGL_CHANT_C_FILE       "kuwahara-max.c"
 
-#define GEGL_CHANT_AREA_FILTER
-#define GEGL_CHANT_PREPARE
-
-#include "gegl-old-chant.h"
+#include "gegl-chant.h"
 #include <math.h>
 
-static void
-kuwahara (GeglBuffer *src,
-          GeglBuffer *dst,
-          gint        radius);
-
-
-static void prepare (GeglOperation *operation)
-{
-  gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
-}
-
-
-static gboolean
-process (GeglOperation       *operation,
-         GeglBuffer          *input,
-         GeglBuffer          *output,
-         const GeglRectangle *result)
-{
-  GeglOperationFilter *filter;
-  GeglChantOperation  *self;
-
-  filter = GEGL_OPERATION_FILTER (operation);
-  self   = GEGL_CHANT_OPERATION (operation);
-
-    {
-      GeglBuffer      *temp_in;
-      GeglRectangle    compute  = gegl_operation_compute_input_request (operation, "input", result);
-
-      temp_in = gegl_buffer_create_sub_buffer (input, &compute);
-      kuwahara (temp_in, output, self->radius);
-      g_object_unref (temp_in);
-    }
-  return  TRUE;
-}
-
 static inline void
 compute_rectangle (gfloat *buf,
                    gint    buf_width,
@@ -86,7 +46,7 @@
   gfloat  max   = -1000000000.0;
   gfloat  min   =  1000000000.0;
   gfloat  mean  =  0.0;
-  gint    count =  0;
+  glong   count =  0;
 
   gint offset = (y0 * buf_width + x0) * 4 + component;
 
@@ -150,8 +110,8 @@
             compute_rectangle (src_buf,
                                gegl_buffer_get_width (src),
                                gegl_buffer_get_height (src),
-                               u - radius -1,
-                               v - radius -1,
+                               u - radius - 1,
+                               v - radius - 1,
                                1 + radius,
                                1 + radius,
                                component,
@@ -179,8 +139,8 @@
                                &variance);
             if (variance<best)
               {
-                best = variance;
                 value = max;
+                best = variance;
               }
 
             compute_rectangle (src_buf,
@@ -197,8 +157,8 @@
                                &variance);
             if (variance<best)
               {
-                best = variance;
                 value = max;
+                best = variance;
               }
 
             compute_rectangle (src_buf,
@@ -213,6 +173,7 @@
                                &max, /* max */
                                NULL,
                                &variance);
+
             if (variance<best)
               {
                 value = max;
@@ -229,12 +190,54 @@
   g_free (dst_buf);
 }
 
+static void prepare (GeglOperation *operation)
+{
+  gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
+}
+
 static void tickle (GeglOperation *operation)
 {
   GeglOperationAreaFilter *area = GEGL_OPERATION_AREA_FILTER (operation);
-  GeglChantOperation      *filter = GEGL_CHANT_OPERATION (operation);
+
   area->left = area->right = area->top = area->bottom =
-  ceil (filter->radius);
+      ceil (GEGL_CHANT_PROPERTIES (operation)->radius);
+}
+
+static gboolean
+process (GeglOperation       *operation,
+         GeglBuffer          *input,
+         GeglBuffer          *output,
+         const GeglRectangle *result)
+{
+  GeglChantO   *o = GEGL_CHANT_PROPERTIES (operation);
+  GeglBuffer   *temp_in;
+  GeglRectangle compute = gegl_operation_compute_input_request (operation, "input", result);
+
+  temp_in = gegl_buffer_create_sub_buffer (input, &compute);
+
+  kuwahara (temp_in, output, o->radius);
+  g_object_unref (temp_in);
+
+  return  TRUE;
+}
+
+
+static void
+operation_class_init (GeglChantClass *klass)
+{
+  GeglOperationClass       *operation_class;
+  GeglOperationFilterClass *filter_class;
+
+  operation_class = GEGL_OPERATION_CLASS (klass);
+  filter_class    = GEGL_OPERATION_FILTER_CLASS (klass);
+
+  filter_class->process = process;
+  operation_class->prepare = prepare;
+  operation_class->tickle  = tickle;
+
+  operation_class->name        = "kuwahara-max";
+  operation_class->categories  = "misc";
+  operation_class->description = "Edge preserving max filter";
 }
 
 #endif

Modified: trunk/operations/workshop/kuwahara-min.c
==============================================================================
--- trunk/operations/workshop/kuwahara-min.c	(original)
+++ trunk/operations/workshop/kuwahara-min.c	Sun Jan 27 01:31:27 2008
@@ -15,60 +15,19 @@
  *
  * Copyright 2006 Ãyvind KolÃs <pippin gimp org>
  */
-#if GEGL_CHANT_PROPERTIES
+#ifdef GEGL_CHANT_PROPERTIES
 
 gegl_chant_double (radius, 0.0, 50.0, 4.0,
   "Radius of square pixel region, (width and height will be radius*2+1.")
 
 #else
 
-#define GEGL_CHANT_NAME            kuwahara_min
-#define GEGL_CHANT_SELF            "kuwahara-min.c"
-#define GEGL_CHANT_DESCRIPTION     "Edge preserving min filter"
-#define GEGL_CHANT_CATEGORIES      "misc"
+#define GEGL_CHANT_TYPE_AREA_FILTER
+#define GEGL_CHANT_C_FILE       "kuwahara-min.c"
 
-#define GEGL_CHANT_AREA_FILTER
-#define GEGL_CHANT_PREPARE
-
-#include "gegl-old-chant.h"
+#include "gegl-chant.h"
 #include <math.h>
 
-static void
-kuwahara (GeglBuffer *src,
-          GeglBuffer *dst,
-          gint        radius);
-
-
-static void prepare (GeglOperation *operation)
-{
-  gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
-}
-
-
-static gboolean
-process (GeglOperation       *operation,
-         GeglBuffer          *input,
-         GeglBuffer          *output,
-         const GeglRectangle *result)
-{
-  GeglOperationFilter *filter;
-  GeglChantOperation  *self;
-
-  filter = GEGL_OPERATION_FILTER (operation);
-  self   = GEGL_CHANT_OPERATION (operation);
-
-    {
-      GeglBuffer      *temp_in;
-      GeglRectangle    compute  = gegl_operation_compute_input_request (operation, "input", result);
-
-      temp_in = gegl_buffer_create_sub_buffer (input, &compute);
-      kuwahara (temp_in, output, self->radius);
-      g_object_unref (temp_in);
-    }
-
-  return  TRUE;
-}
-
 static inline void
 compute_rectangle (gfloat *buf,
                    gint    buf_width,
@@ -87,7 +46,7 @@
   gfloat  max   = -1000000000.0;
   gfloat  min   =  1000000000.0;
   gfloat  mean  =  0.0;
-  gint    count =  0;
+  glong   count =  0;
 
   gint offset = (y0 * buf_width + x0) * 4 + component;
 
@@ -214,6 +173,7 @@
                                NULL, /* max */
                                NULL,
                                &variance);
+
             if (variance<best)
               {
                 value = min;
@@ -230,12 +190,54 @@
   g_free (dst_buf);
 }
 
+static void prepare (GeglOperation *operation)
+{
+  gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
+}
+
 static void tickle (GeglOperation *operation)
 {
   GeglOperationAreaFilter *area = GEGL_OPERATION_AREA_FILTER (operation);
-  GeglChantOperation      *filter = GEGL_CHANT_OPERATION (operation);
+
   area->left = area->right = area->top = area->bottom =
-  ceil (filter->radius);
+      ceil (GEGL_CHANT_PROPERTIES (operation)->radius);
+}
+
+static gboolean
+process (GeglOperation       *operation,
+         GeglBuffer          *input,
+         GeglBuffer          *output,
+         const GeglRectangle *result)
+{
+  GeglChantO   *o = GEGL_CHANT_PROPERTIES (operation);
+  GeglBuffer   *temp_in;
+  GeglRectangle compute = gegl_operation_compute_input_request (operation, "input", result);
+
+  temp_in = gegl_buffer_create_sub_buffer (input, &compute);
+
+  kuwahara (temp_in, output, o->radius);
+  g_object_unref (temp_in);
+
+  return  TRUE;
+}
+
+
+static void
+operation_class_init (GeglChantClass *klass)
+{
+  GeglOperationClass       *operation_class;
+  GeglOperationFilterClass *filter_class;
+
+  operation_class = GEGL_OPERATION_CLASS (klass);
+  filter_class    = GEGL_OPERATION_FILTER_CLASS (klass);
+
+  filter_class->process = process;
+  operation_class->prepare = prepare;
+  operation_class->tickle  = tickle;
+
+  operation_class->name        = "kuwahara-min";
+  operation_class->categories  = "misc";
+  operation_class->description = "Edge preserving min filter";
 }
 
 #endif

Modified: trunk/operations/workshop/kuwahara.c
==============================================================================
--- trunk/operations/workshop/kuwahara.c	(original)
+++ trunk/operations/workshop/kuwahara.c	Sun Jan 27 01:31:27 2008
@@ -15,61 +15,19 @@
  *
  * Copyright 2006 Ãyvind KolÃs <pippin gimp org>
  */
-#if GEGL_CHANT_PROPERTIES
+#ifdef GEGL_CHANT_PROPERTIES
 
 gegl_chant_double (radius, 0.0, 50.0, 10.0,
   "Radius of square pixel region, (width and height will be radius*2+1.")
 
 #else
 
-#define GEGL_CHANT_NAME            kuwahara
-#define GEGL_CHANT_SELF            "kuwahara.c"
-#define GEGL_CHANT_DESCRIPTION     "Edge preserving blur"
-#define GEGL_CHANT_CATEGORIES      "misc"
+#define GEGL_CHANT_TYPE_AREA_FILTER
+#define GEGL_CHANT_C_FILE       "kuwahara.c"
 
-#define GEGL_CHANT_AREA_FILTER
-#define GEGL_CHANT_PREPARE
-
-#include "gegl-old-chant.h"
+#include "gegl-chant.h"
 #include <math.h>
 
-static void
-kuwahara (GeglBuffer *src,
-          GeglBuffer *dst,
-          gint        radius);
-
-
-static void prepare (GeglOperation *operation)
-{
-  gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
-}
-
-
-static gboolean
-process (GeglOperation       *operation,
-         GeglBuffer          *input,
-         GeglBuffer          *output,
-         const GeglRectangle *result)
-{
-  GeglOperationFilter *filter;
-  GeglChantOperation  *self;
-
-  filter = GEGL_OPERATION_FILTER (operation);
-  self   = GEGL_CHANT_OPERATION (operation);
-
-    {
-      GeglBuffer          *temp_in;
-      GeglRectangle        compute  = gegl_operation_compute_input_request (operation, "input", result);
-
-      temp_in = gegl_buffer_create_sub_buffer (input, &compute);
-
-      kuwahara (temp_in, output, self->radius);
-      g_object_unref (temp_in);
-    }
-
-  return  TRUE;
-}
-
 static inline void
 compute_rectangle (gfloat *buf,
                    gint    buf_width,
@@ -171,7 +129,7 @@
                                gegl_buffer_get_width (src),
                                gegl_buffer_get_height (src),
                                u,
-                               v - radius -1,
+                               v - radius - 1,
                                1 + radius,
                                1 + radius,
                                component,
@@ -185,11 +143,10 @@
                 value = mean;
               }
 
-
             compute_rectangle (src_buf,
                                gegl_buffer_get_width (src),
                                gegl_buffer_get_height (src),
-                               u - radius -1,
+                               u - radius - 1,
                                v,
                                1 + radius,
                                1 + radius,
@@ -233,13 +190,54 @@
   g_free (dst_buf);
 }
 
+static void prepare (GeglOperation *operation)
+{
+  gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
+}
+
 static void tickle (GeglOperation *operation)
 {
   GeglOperationAreaFilter *area = GEGL_OPERATION_AREA_FILTER (operation);
-  GeglChantOperation      *filter = GEGL_CHANT_OPERATION (operation);
+
   area->left = area->right = area->top = area->bottom =
-  ceil (filter->radius);
+      ceil (GEGL_CHANT_PROPERTIES (operation)->radius);
 }
 
+static gboolean
+process (GeglOperation       *operation,
+         GeglBuffer          *input,
+         GeglBuffer          *output,
+         const GeglRectangle *result)
+{
+  GeglChantO   *o = GEGL_CHANT_PROPERTIES (operation);
+  GeglBuffer   *temp_in;
+  GeglRectangle compute = gegl_operation_compute_input_request (operation, "input", result);
+
+  temp_in = gegl_buffer_create_sub_buffer (input, &compute);
+
+  kuwahara (temp_in, output, o->radius);
+  g_object_unref (temp_in);
+
+  return  TRUE;
+}
+
+
+static void
+operation_class_init (GeglChantClass *klass)
+{
+  GeglOperationClass       *operation_class;
+  GeglOperationFilterClass *filter_class;
+
+  operation_class = GEGL_OPERATION_CLASS (klass);
+  filter_class    = GEGL_OPERATION_FILTER_CLASS (klass);
+
+  filter_class->process = process;
+  operation_class->prepare = prepare;
+  operation_class->tickle  = tickle;
+
+  operation_class->name        = "kuwahara";
+  operation_class->categories  = "misc";
+  operation_class->description = "Edge preserving blur";
+}
 
 #endif

Modified: trunk/operations/workshop/lens-correct.c
==============================================================================
--- trunk/operations/workshop/lens-correct.c	(original)
+++ trunk/operations/workshop/lens-correct.c	Sun Jan 27 01:31:27 2008
@@ -16,28 +16,21 @@
  * Copyright 2006 Ãyvind KolÃs <pippin gimp org>
  * Copyright 2008 Bradley Broom <bmbroom gmail com>
  */
-#if GEGL_CHANT_PROPERTIES
+#ifdef GEGL_CHANT_PROPERTIES
 
 gegl_chant_pointer (lens_info_pointer, "Pointer to LensCorrectionModel")
 
 #else
 
-#define GEGL_CHANT_NAME            lens_correct
-#define GEGL_CHANT_SELF            "lens-correct.c"
-#define GEGL_CHANT_DESCRIPTION     "Copies image performing lens distortion correction."
-#define GEGL_CHANT_CATEGORIES      "blur"
-#define GEGL_CHANT_CLASS_INIT 	   /* we need to modify the standard class init of the super class */
-
-#define GEGL_CHANT_FILTER
-
-#include "gegl-old-chant.h"
+#define GEGL_CHANT_TYPE_FILTER
+#define GEGL_CHANT_C_FILE       "lens-correct.c"
 
+#include "gegl-chant.h"
 #include <math.h>
-
 #include "lens-correct.h"
 
 #if 0
-#define TRACE 		/* Define this to see basic tracing info. */
+#define TRACE       /* Define this to see basic tracing info. */
 #endif
 
 /* Find the src pixel that maps to the destination pixel passed as parameters x and y.
@@ -47,7 +40,6 @@
                 gfloat x, gfloat y, gfloat *srcx, gfloat *srcy)
 {
   double r, radj;
-  double dx, dy;
 
   r = hypot (x - lcip->cx, y - lcip->cy) / lcip->rscale;
   radj = (((pp->a*r+pp->b)*r+pp->c)*r+pp->d);
@@ -59,7 +51,7 @@
  */
 static void
 find_dst_pixel (LensCorrectionModel *lcip, ChannelCorrectionModel *pp,
-		gfloat x, gfloat y, gfloat *dstx, gfloat *dsty)
+        gfloat x, gfloat y, gfloat *dstx, gfloat *dsty)
 {
     /* Compute scaled distance of pixel from image center. */
     gfloat srcr = hypot (x - lcip->cx, y - lcip->cy) / lcip->rscale;
@@ -69,51 +61,51 @@
      */
     if (srcr < 0.01/lcip->rscale) {
         *dstx = x;
-	*dsty = y;
+    *dsty = y;
     }
     else {
-	gfloat dstr = srcr;
+    gfloat dstr = srcr;
         gfloat r;
-	#ifdef COUNT_IT
-	  int it = 0;
-	#endif
-
-	/* Adjust dstr until r is within about one hundred of a pixel of srcr.
-	 * Usually, one iteration is enough.
-	 */
-	r = (((pp->a*dstr+pp->b)*dstr+pp->c)*dstr+pp->d) * dstr;
-	while (fabs (r - srcr) > 0.01/lcip->rscale) {
-	    /* Compute derivative of lens distortion function at dstr. */
+    #ifdef COUNT_IT
+      int it = 0;
+    #endif
+
+    /* Adjust dstr until r is within about one hundred of a pixel of srcr.
+     * Usually, one iteration is enough.
+     */
+    r = (((pp->a*dstr+pp->b)*dstr+pp->c)*dstr+pp->d) * dstr;
+    while (fabs (r - srcr) > 0.01/lcip->rscale) {
+        /* Compute derivative of lens distortion function at dstr. */
             gfloat dr = ((4.0*pp->a*dstr+3.0*pp->b)*dstr+2.0*pp->c)*dstr+pp->d;
-	    if (fabs(dr) < 1.0e-5) {
-		/* In theory, the derivative of a quartic function can have zeros,
-		 * but I don't think any valid lens correction model will.
-		 * Still, we check to avoid an infinite loop if the ChannelCorrectionModel is broken.
-		 */
-	        g_warning ("find_dst_pixel: x=%g y=%g found zero slope, bailing out", x, y);
-		break;
-	    }
-	    /* Adjust dstr based on error distance and current derivative. */
-	    dstr += (srcr-r)/dr;
-	    #ifdef COUNT_IT
-	      it++;
-	    #endif
+        if (fabs(dr) < 1.0e-5) {
+        /* In theory, the derivative of a quartic function can have zeros,
+         * but I don't think any valid lens correction model will.
+         * Still, we check to avoid an infinite loop if the ChannelCorrectionModel is broken.
+         */
+            g_warning ("find_dst_pixel: x=%g y=%g found zero slope, bailing out", x, y);
+        break;
+        }
+        /* Adjust dstr based on error distance and current derivative. */
+        dstr += (srcr-r)/dr;
+        #ifdef COUNT_IT
+          it++;
+        #endif
             r = (((pp->a*dstr+pp->b)*dstr+pp->c)*dstr+pp->d) * dstr;
-	}
-	#ifdef COUNT_IT
-	  g_warning ("find_dst_pixel: iterations == %d", it);
-	#endif
-
-	/* Compute dst x,y coords from change in radial distance from image center. */
-	*dstx = (x - lcip->cx) * (dstr/srcr) + lcip->cx;
-	*dsty = (y - lcip->cy) * (dstr/srcr) + lcip->cy;
+    }
+    #ifdef COUNT_IT
+      g_warning ("find_dst_pixel: iterations == %d", it);
+    #endif
+
+    /* Compute dst x,y coords from change in radial distance from image center. */
+    *dstx = (x - lcip->cx) * (dstr/srcr) + lcip->cx;
+    *dsty = (y - lcip->cy) * (dstr/srcr) + lcip->cy;
     }
 }
 
 /* Define the type of the above two functions.
  */
 typedef void pixel_map_func (LensCorrectionModel *lcip, ChannelCorrectionModel *pp,
-			     gfloat x, gfloat y, gfloat *dstx, gfloat *dsty);
+                 gfloat x, gfloat y, gfloat *dstx, gfloat *dsty);
 
 /* Compute the bounding box of the GeglRectangle, *in_rect,
  * when passed through the pixel mapping function given by *mappix,
@@ -143,43 +135,43 @@
       (*mappix) (lcip, &lcip->green, in_rect->x, in_rect->y, &minx, &miny);
       maxx = minx; maxy = miny;
       for (ii = 0; ii < 2*(in_rect->width+in_rect->height); ii++) {
-	/* Compute srcx,srcy coordinate for this point on the perimeter. */
-	gint srcx = in_rect->x;
-	gint srcy = in_rect->y;
-	if (ii < in_rect->width)
-	  {
-	    srcx += ii;
-	  }
-	else if (ii < in_rect->width + in_rect->height)
-	  {
-	    srcx += in_rect->width;
-	    srcy += (ii - in_rect->width);
-	  }
-	else if (ii < 2*in_rect->width + in_rect->height)
-	  {
-	    srcy += in_rect->height;
-	    srcx += 2*in_rect->width + in_rect->height - ii;
-	  }
-	else
-	  {
-	    srcy += 2*(in_rect->width + in_rect->height) - ii;
-	  }
-	/* Find dst pixels for each color channel. */
+    /* Compute srcx,srcy coordinate for this point on the perimeter. */
+    gint srcx = in_rect->x;
+    gint srcy = in_rect->y;
+    if (ii < in_rect->width)
+      {
+        srcx += ii;
+      }
+    else if (ii < in_rect->width + in_rect->height)
+      {
+        srcx += in_rect->width;
+        srcy += (ii - in_rect->width);
+      }
+    else if (ii < 2*in_rect->width + in_rect->height)
+      {
+        srcy += in_rect->height;
+        srcx += 2*in_rect->width + in_rect->height - ii;
+      }
+    else
+      {
+        srcy += 2*(in_rect->width + in_rect->height) - ii;
+      }
+    /* Find dst pixels for each color channel. */
         (*mappix) (lcip, &lcip->green, srcx, srcy, &x, &y);
-	if (x < minx) minx = x;
-	else if (x > maxx) maxx = x;
-	if (y < miny) miny = y;
-	else if (y > maxy) maxy = y;
+    if (x < minx) minx = x;
+    else if (x > maxx) maxx = x;
+    if (y < miny) miny = y;
+    else if (y > maxy) maxy = y;
         (*mappix) (lcip, &lcip->red, srcx, srcy, &x, &y);
-	if (x < minx) minx = x;
-	else if (x > maxx) maxx = x;
-	if (y < miny) miny = y;
-	else if (y > maxy) maxy = y;
+    if (x < minx) minx = x;
+    else if (x > maxx) maxx = x;
+    if (y < miny) miny = y;
+    else if (y > maxy) maxy = y;
         (*mappix) (lcip, &lcip->blue, srcx, srcy, &x, &y);
-	if (x < minx) minx = x;
-	else if (x > maxx) maxx = x;
-	if (y < miny) miny = y;
-	else if (y > maxy) maxy = y;
+    if (x < minx) minx = x;
+    else if (x > maxx) maxx = x;
+    if (y < miny) miny = y;
+    else if (y > maxy) maxy = y;
       }
       result.x = minx;
       result.y = miny;
@@ -198,8 +190,7 @@
 #define ROW src_extent->width
 #define COL 1
 static void
-copy_through_lens (GeglChantOperation *op,
-	           LensCorrectionModel *oip,
+copy_through_lens (LensCorrectionModel *oip,
                    GeglBuffer *src,
                    GeglBuffer *dst)
 {
@@ -207,16 +198,16 @@
   const GeglRectangle *dst_extent;
   gfloat *src_buf;
   gfloat *dst_buf;
-  gint x,y;				/* Coordinate of current dst pixel. */
-  gint rgb;				/* Color channel of dst pixel being processed. */
-  gint doffset;				/* Buffer offset of current dst pixel. */
+  gint x,y;             /* Coordinate of current dst pixel. */
+  gint rgb;             /* Color channel of dst pixel being processed. */
+  gint doffset;             /* Buffer offset of current dst pixel. */
   gint tmpx, tmpy, toff;
-  ChannelCorrectionModel *ccm[3];	/* Allow access to red,green,blue models in loop. */
+  ChannelCorrectionModel *ccm[3];   /* Allow access to red,green,blue models in loop. */
 
   src_extent = gegl_buffer_get_extent (src);
   #ifdef TRACE
     g_warning ("> copy_through_lens src_extent = %dx%d+%d+%d",
-    		     src_extent->width, src_extent->height, src_extent->x,src_extent->y);
+                 src_extent->width, src_extent->height, src_extent->x,src_extent->y);
   #endif
   if (dst == NULL)
     {
@@ -234,7 +225,7 @@
       #endif
       return;
   }
-  
+
   /* Get src pixels. */
   src_buf = g_malloc0 (gegl_buffer_get_pixel_count (src) * 4 * 3);
   gegl_buffer_get (src, 1.0, NULL, babl_format ("RGB float"), src_buf, GEGL_AUTO_ROWSTRIDE);
@@ -250,50 +241,50 @@
   for (y=dst_extent->y; y<dst_extent->height + dst_extent->y; y++)
     {
       for (x=dst_extent->x; x<dst_extent->width + dst_extent->x; x++)
-	{
-	  for (rgb = 0; rgb < 3; rgb++)
-	    {
-	      gfloat gx, gy;
-	      gfloat val = 0.0;
-	      gint xx, yy;
-	      gfloat wx[2], wy[2], wt = 0.0;
-
-	      find_src_pixel (oip, ccm[rgb], (gfloat)x, (gfloat)y, &gx, &gy);
-	      tmpx = gx;
-	      tmpy = gy;
-	      wx[1] = gx - tmpx;
-	      wx[0] = 1.0 - wx[1];
-	      wy[1] = gy - tmpy;
-	      wy[0] = 1.0 - wy[1];
-	      tmpx -= src_extent->x;
-	      tmpy -= src_extent->y;
-	      toff = (tmpy * ROW + tmpx) * 3;
-	      for (xx = 0; xx < 2; xx++)
-	        {
-		  for (yy = 0; yy < 2; yy++)
-		    {
-		      if (tmpx+xx >= 0 && tmpx+xx < src_extent->width &&
-		          tmpy+yy >= 0 && tmpy+yy < src_extent->height)
-		        {
-			  val += src_buf[toff+(yy*ROW+xx)*3+rgb] * wx[xx] * wy[yy];
-			  wt += wx[xx] * wy[yy];
-			}
-		    }
-		}
-	      if (wt <= 0)
-		{
-		  g_warning ("gegl_lens_correct: mapped pixel %g,%g not in %dx%d+%d+%d", gx, gy,
-			     src_extent->width, src_extent->height, src_extent->x, src_extent->y);
-		  g_warning ("                   dst = %dx%d+%d+%d", dst_extent->width, dst_extent->height, dst_extent->x,dst_extent->y);
-		  dst_buf [doffset+rgb] = 0.0;
-		}
-	      else
-		{
-		  dst_buf [doffset+rgb] = val / wt;
-		}
-	    }
-	  doffset+=3;
-	}
+    {
+      for (rgb = 0; rgb < 3; rgb++)
+        {
+          gfloat gx, gy;
+          gfloat val = 0.0;
+          gint xx, yy;
+          gfloat wx[2], wy[2], wt = 0.0;
+
+          find_src_pixel (oip, ccm[rgb], (gfloat)x, (gfloat)y, &gx, &gy);
+          tmpx = gx;
+          tmpy = gy;
+          wx[1] = gx - tmpx;
+          wx[0] = 1.0 - wx[1];
+          wy[1] = gy - tmpy;
+          wy[0] = 1.0 - wy[1];
+          tmpx -= src_extent->x;
+          tmpy -= src_extent->y;
+          toff = (tmpy * ROW + tmpx) * 3;
+          for (xx = 0; xx < 2; xx++)
+            {
+          for (yy = 0; yy < 2; yy++)
+            {
+              if (tmpx+xx >= 0 && tmpx+xx < src_extent->width &&
+                  tmpy+yy >= 0 && tmpy+yy < src_extent->height)
+                {
+              val += src_buf[toff+(yy*ROW+xx)*3+rgb] * wx[xx] * wy[yy];
+              wt += wx[xx] * wy[yy];
+            }
+            }
+        }
+          if (wt <= 0)
+        {
+          g_warning ("gegl_lens_correct: mapped pixel %g,%g not in %dx%d+%d+%d", gx, gy,
+                 src_extent->width, src_extent->height, src_extent->x, src_extent->y);
+          g_warning ("                   dst = %dx%d+%d+%d", dst_extent->width, dst_extent->height, dst_extent->x,dst_extent->y);
+          dst_buf [doffset+rgb] = 0.0;
+        }
+          else
+        {
+          dst_buf [doffset+rgb] = val / wt;
+        }
+        }
+      doffset+=3;
+    }
     }
 
   /* Store dst pixels. */
@@ -317,7 +308,7 @@
 {
   GeglRectangle  result = {0,0,0,0};
   GeglRectangle *in_rect = gegl_operation_source_get_defined_region (operation, "input");
-  GeglChantOperation *area = GEGL_CHANT_OPERATION (operation);
+  GeglChantO    *area = GEGL_CHANT_PROPERTIES (operation);
 
   #ifdef TRACE
     g_warning ("> get_defined_region pointer == 0x%x in_rect == 0x%x", area->lens_info_pointer, in_rect);
@@ -338,7 +329,7 @@
                        const gchar         *input_pad,
                        const GeglRectangle *roi)
 {
-  GeglChantOperation *area = GEGL_CHANT_OPERATION (operation);
+  GeglChantO   *area = GEGL_CHANT_PROPERTIES (operation);
   GeglRectangle result = *gegl_operation_source_get_defined_region (operation, "input");
   #ifdef TRACE
     g_warning ("> compute_input_request src=%dx%d+%d+%d", result.width, result.height, result.x, result.y);
@@ -379,24 +370,32 @@
          GeglBuffer          *output,
          const GeglRectangle *result)
 {
-  GeglChantOperation  *self = GEGL_CHANT_OPERATION (operation);
+  GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
 
-  copy_through_lens (self, self->lens_info_pointer, input, output);
+  copy_through_lens (o->lens_info_pointer, input, output);
 
   return TRUE;
 }
 
-/* This is called at the end of the gobject class_init function, the
- * definition of GEGL_CHANT_CLASS_INIT above is needed to make this happen.
- *
- * Here we override the standard passthrough options for the rect
- * computations.
- */
-static void class_init (GeglOperationClass *operation_class)
+
+static void
+operation_class_init (GeglChantClass *klass)
 {
-  operation_class->get_defined_region    = get_defined_region;
+  GeglOperationClass       *operation_class;
+  GeglOperationFilterClass *filter_class;
+
+  operation_class = GEGL_OPERATION_CLASS (klass);
+  filter_class    = GEGL_OPERATION_FILTER_CLASS (klass);
+
+  filter_class->process = process;
+  operation_class->prepare = prepare;
+  operation_class->get_defined_region = get_defined_region;
   operation_class->compute_input_request = compute_input_request;
-  operation_class->prepare               = prepare;
+
+  operation_class->name        = "lens-correct";
+  operation_class->categories  = "blur";
+  operation_class->description =
+        "Copies image performing lens distortion correction.";
 }
 
 #endif

Modified: trunk/operations/workshop/line-profile.c
==============================================================================
--- trunk/operations/workshop/line-profile.c	(original)
+++ trunk/operations/workshop/line-profile.c	Sun Jan 27 01:31:27 2008
@@ -15,7 +15,7 @@
  *
  * Copyright 2007 Ãyvind KolÃs <pippin gimp org>
  */
-#if GEGL_CHANT_PROPERTIES
+#ifdef GEGL_CHANT_PROPERTIES
 
 gegl_chant_int (x0, 0, 1000, 0, "start x coordinate")
 gegl_chant_int (x1, 0, 1000, 200, "end x coordinate")
@@ -28,15 +28,10 @@
 
 #else
 
-#define GEGL_CHANT_NAME            line_profile
-#define GEGL_CHANT_SELF            "line-profile.c"
-#define GEGL_CHANT_DESCRIPTION     "Renders luminance profiles for red green and blue components along the specified line in the input buffer, plotted in a buffer of the specified size."
-#define GEGL_CHANT_CATEGORIES      "debug"
+#define GEGL_CHANT_TYPE_FILTER
+#define GEGL_CHANT_C_FILE       "line-profile.c"
 
-#define GEGL_CHANT_FILTER
-#define GEGL_CHANT_CLASS_INIT
-
-#include "gegl-old-chant.h"
+#include "gegl-chant.h"
 #include <cairo.h>
 
 static gfloat
@@ -58,9 +53,9 @@
          GeglBuffer          *output,
          const GeglRectangle *result)
 {
-  GeglChantOperation  *self = GEGL_CHANT_OPERATION (operation);
-  gint width = MAX(MAX (self->width, self->x0), self->x1);
-  gint height = MAX(MAX (self->height, self->y0), self->y1);
+  GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+  gint        width = MAX(MAX (o->width, o->x0), o->x1);
+  gint        height = MAX(MAX (o->height, o->y0), o->y1);
 
   {
     GeglRectangle extent = {0,0,width,height};
@@ -74,18 +69,18 @@
     cairo_surface_t *surface = cairo_image_surface_create_for_data (buf, CAIRO_FORMAT_ARGB32, width, height, width * 4);
     cr = cairo_create (surface);
   /*  cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 1.0);
-    cairo_rectangle (cr, 0,0, self->width, self->height);
+    cairo_rectangle (cr, 0,0, o->width, o->height);
     cairo_fill (cr);*/
 
-#define val2y(val) (self->height - (val - self->min) * self->height / (self->max-self->min))
+#define val2y(val) (o->height - (val - o->min) * o->height / (o->max-o->min))
 
     cairo_set_source_rgba (cr, .0, .0, .8, 0.5);
     cairo_move_to (cr, 0, val2y(0.0));
-    cairo_line_to (cr, self->width, val2y(0.0));
+    cairo_line_to (cr, o->width, val2y(0.0));
 
     cairo_set_source_rgba (cr, .8, .8, .0, 0.5);
     cairo_move_to (cr, 0, val2y(1.0));
-    cairo_line_to (cr, self->width, val2y(1.0));
+    cairo_line_to (cr, o->width, val2y(1.0));
 
     cairo_stroke (cr);
 
@@ -93,11 +88,11 @@
     {
       gint x;
       cairo_set_source_rgba (cr, 1.0, 0.0, 0.0, 1.0);
-      for (x=0;x<self->width;x++)
+      for (x=0;x<o->width;x++)
         {
-          gfloat t = (1.0*x)/self->width;
-          gint sx = ((1.0-t) * self->x0) + (t * self->x1);
-          gint sy = ((1.0-t) * self->y0) + (t * self->y1);
+          gfloat t = (1.0*x)/o->width;
+          gint sx = ((1.0-t) * o->x0) + (t * o->x1);
+          gint sy = ((1.0-t) * o->y0) + (t * o->y1);
           cairo_line_to (cr, x, val2y(buffer_sample(input,sx,sy,0)));
         }
       cairo_stroke (cr);
@@ -105,11 +100,11 @@
     {
       gint x;
       cairo_set_source_rgba (cr, 0.0, 1.0, 0.0, 1.0);
-      for (x=0;x<self->width;x++)
+      for (x=0;x<o->width;x++)
         {
-          gfloat t = (1.0*x)/self->width;
-          gint sx = ((1.0-t) * self->x0) + (t * self->x1);
-          gint sy = ((1.0-t) * self->y0) + (t * self->y1);
+          gfloat t = (1.0*x)/o->width;
+          gint sx = ((1.0-t) * o->x0) + (t * o->x1);
+          gint sy = ((1.0-t) * o->y0) + (t * o->y1);
           cairo_line_to (cr, x, val2y(buffer_sample(input,sx,sy,1)));
         }
       cairo_stroke (cr);
@@ -117,18 +112,18 @@
     {
       gint x;
       cairo_set_source_rgba (cr, 0.0, 0.0, 1.0, 1.0);
-      for (x=0;x<self->width;x++)
+      for (x=0;x<o->width;x++)
         {
-          gfloat t = (1.0*x)/self->width;
-          gint sx = ((1.0-t) * self->x0) + (t * self->x1);
-          gint sy = ((1.0-t) * self->y0) + (t * self->y1);
+          gfloat t = (1.0*x)/o->width;
+          gint sx = ((1.0-t) * o->x0) + (t * o->x1);
+          gint sy = ((1.0-t) * o->y0) + (t * o->y1);
           cairo_line_to (cr, x, val2y(buffer_sample(input,sx,sy,2)));
         }
       cairo_stroke (cr);
     }
    cairo_set_source_rgba (cr, 1.0, 0.0, 0.0, 0.4);
-   cairo_move_to (cr, self->x0, self->y0);
-   cairo_line_to (cr, self->x1, self->y1);
+   cairo_move_to (cr, o->x0, o->y0);
+   cairo_line_to (cr, o->x1, o->y1);
    cairo_stroke (cr);
 
     gegl_buffer_set (output, NULL, babl_format ("B'aG'aR'aA u8"), buf, GEGL_AUTO_ROWSTRIDE);
@@ -148,18 +143,34 @@
 static GeglRectangle
 get_defined_region (GeglOperation *operation)
 {
-  GeglChantOperation *self = GEGL_CHANT_OPERATION (operation);
-  GeglRectangle defined = {0,0,self->width,self->height};
+  GeglChantO   *o = GEGL_CHANT_PROPERTIES (operation);
+  GeglRectangle defined = {0,0,o->width,o->height};
 
-  defined.width = MAX(MAX (self->width, self->x0), self->x1);
-  defined.height = MAX(MAX (self->height, self->y0), self->y1);
+  defined.width  = MAX (MAX (o->width,  o->x0), o->x1);
+  defined.height = MAX (MAX (o->height, o->y0), o->y1);
   return defined;
 }
 
-static void class_init (GeglOperationClass *operation_class)
+
+static void
+operation_class_init (GeglChantClass *klass)
 {
+  GeglOperationClass       *operation_class;
+  GeglOperationFilterClass *filter_class;
+
+  operation_class = GEGL_OPERATION_CLASS (klass);
+  filter_class    = GEGL_OPERATION_FILTER_CLASS (klass);
+
+  filter_class->process = process;
   operation_class->compute_input_request = compute_input_request;
   operation_class->get_defined_region = get_defined_region;
+
+  operation_class->name        = "line-profile";
+  operation_class->categories  = "debug";
+  operation_class->description =
+        "Renders luminance profiles for red green and blue components along"
+        " the specified line in the input buffer, plotted in a buffer of the"
+        " specified size.";
 }
 
 #endif

Modified: trunk/operations/workshop/mandelbrot.c
==============================================================================
--- trunk/operations/workshop/mandelbrot.c	(original)
+++ trunk/operations/workshop/mandelbrot.c	Sun Jan 27 01:31:27 2008
@@ -15,7 +15,7 @@
  *
  * Copyright 2006 Ãyvind KolÃs <pippin gimp org>
  */
-#if GEGL_CHANT_PROPERTIES
+#ifdef GEGL_CHANT_PROPERTIES
 
 gegl_chant_double(real, -200.0, 200.0, -1.77, "imaginary coordinate")
 gegl_chant_double(img,  -200.0, 200.0, 0.0, "real coordinate")
@@ -24,22 +24,17 @@
 
 #else
 
-#define GEGL_CHANT_NAME           mandelbrot
-#define GEGL_CHANT_SELF           "mandelbrot.c"
-#define GEGL_CHANT_DESCRIPTION    "Mandelbrot renderer."
-#define GEGL_CHANT_CATEGORIES     "render"
-#define GEGL_CHANT_PREPARE
-#define GEGL_CHANT_CLASS_INIT
+#define GEGL_CHANT_TYPE_SOURCE
+#define GEGL_CHANT_C_FILE           "mandelbrot.c"
 
-#define GEGL_CHANT_SOURCE
+#include "gegl-chant.h"
 
-#include "gegl-old-chant.h"
-
-static gfloat mandel_calc(GeglChantOperation *self, gfloat x, gfloat y)
+static gfloat
+mandel_calc(GeglChantO *o, gfloat x, gfloat y)
 {
-  gfloat fViewRectReal = self->real;
-  gfloat fViewRectImg  = self->img;
-  gfloat fMagLevel     = self->level;
+  gfloat fViewRectReal = o->real;
+  gfloat fViewRectImg  = o->img;
+  gfloat fMagLevel     = o->level;
 
   gfloat fCReal = fViewRectReal + x * fMagLevel;
   gfloat fCImg  = fViewRectImg + y * fMagLevel;
@@ -48,13 +43,13 @@
 
         gint n;
 
-        for (n=0;n<self->maxiter;n++)
+        for (n=0;n<o->maxiter;n++)
           {
                 gfloat fZRealSquared = fZReal * fZReal;
                 gfloat fZImgSquared = fZImg * fZImg;
 
                 if (fZRealSquared + fZImgSquared > 4)
-                        return 1.0*n/(self->maxiter);
+                        return 1.0*n/(o->maxiter);
 
 /*                -- z = z^2 + c*/
                 fZImg = 2 * fZReal * fZImg + fCImg;
@@ -68,66 +63,75 @@
   gegl_operation_set_format (operation, "output", babl_format ("Y float"));
 }
 
+static GeglRectangle
+get_defined_region (GeglOperation *operation)
+{
+  GeglRectangle result = {-256,-256, 1024, 1024};
+  return result;
+}
+
 static gboolean
 process (GeglOperation       *operation,
          GeglNodeContext     *context,
          GeglBuffer          *output,
          const GeglRectangle *result)
 {
-  GeglChantOperation  *self = GEGL_CHANT_OPERATION (operation);
-
-  {
-    gfloat *buf;
-    gint pxsize;
-
-    g_object_get (output, "px-size", &pxsize, NULL);
-
-    buf = g_malloc (result->width * result->height * pxsize);
-
-
-      {
-        gfloat *dst=buf;
-        gint y;
-        for (y=0; y < result->height; y++)
-          {
-            gint x;
-            for (x=0; x < result->width ; x++)
-              {
-                gfloat value;
-                gfloat nx,ny;
-
-                nx = (x + result->x) ;
-                ny = (y + result->y) ;
-
-                nx = (nx/512);
-                ny = (ny/512);
-
-                value = mandel_calc (self, nx, ny);
-
-                *dst = value;
-                dst ++;
-              }
-          }
-      }
-
-    gegl_buffer_set (output, NULL, babl_format ("Y float"), buf,
-                     GEGL_AUTO_ROWSTRIDE);
-    g_free (buf);
-  }
+  GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+  gfloat     *buf;
+  gint        pxsize;
+
+  g_object_get (output, "px-size", &pxsize, NULL);
+
+  buf = g_malloc (result->width * result->height * pxsize);
+
+    {
+      gfloat *dst = buf;
+      gint y;
+      for (y=0; y < result->height; y++)
+        {
+          gint x;
+          for (x=0; x < result->width ; x++)
+            {
+              gfloat value;
+              gfloat nx,ny;
+
+              nx = (x + result->x);
+              ny = (y + result->y);
+
+              nx = (nx/512);
+              ny = (ny/512);
+
+              value = mandel_calc (o, nx, ny);
+
+              *dst++ = value;
+            }
+        }
+    }
+
+  gegl_buffer_set (output, NULL, babl_format ("Y float"), buf,
+                   GEGL_AUTO_ROWSTRIDE);
+  g_free (buf);
 
   return  TRUE;
 }
 
-static GeglRectangle
-get_defined_region (GeglOperation *operation)
-{
-  GeglRectangle result = {-256,-256, 1024, 1024};
-  return result;
-}
 
-static void class_init (GeglOperationClass *klass)
+static void
+operation_class_init (GeglChantClass *klass)
 {
-  klass->adjust_result_region = NULL;
+  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->prepare = prepare;
+  operation_class->get_defined_region = get_defined_region;
+
+  operation_class->name        = "mandelbrot";
+  operation_class->categories  = "render";
+  operation_class->description = "Mandelbrot renderer.";
 }
 
 #endif

Modified: trunk/operations/workshop/max-envelope.c
==============================================================================
--- trunk/operations/workshop/max-envelope.c	(original)
+++ trunk/operations/workshop/max-envelope.c	Sun Jan 27 01:31:27 2008
@@ -16,74 +16,22 @@
  * Copyright 2007 Ãyvind KolÃs     <pippin gimp org>
  */
 
-#if GEGL_CHANT_PROPERTIES
+#ifdef GEGL_CHANT_PROPERTIES
 
 gegl_chant_int (radius,     2, 5000.0, 50, "neighbourhood taken into account")
 gegl_chant_int (samples,    0, 1000,   3,    "number of samples to do")
 gegl_chant_int (iterations, 0, 1000.0, 20,   "number of iterations (length of exposure)")
 gegl_chant_boolean (same_spray, FALSE, "")
 gegl_chant_double (rgamma, 0.0, 8.0, 1.8, "gamma applied to radial distribution")
-#else
 
-#define GEGL_CHANT_NAME         max_envelope
-#define GEGL_CHANT_SELF         "max-envelope.c"
-#define GEGL_CHANT_DESCRIPTION  "Maximum envelope as used by STRESS."
-#define GEGL_CHANT_CATEGORIES   "enhance"
+#else
 
-#define GEGL_CHANT_AREA_FILTER
-#define GEGL_CHANT_PREPARE
+#define GEGL_CHANT_TYPE_AREA_FILTER
+#define GEGL_CHANT_C_FILE       "max-envelope.c"
 
-#include "gegl-old-chant.h"
+#include "gegl-chant.h"
 #include <math.h>
-
-static void max_envelope (GeglBuffer *src,
-                          GeglBuffer *dst,
-                          gint        radius,
-                          gint        samples,
-                          gint        iterations,
-                          gboolean    same_spray,
-                          gdouble     rgamma);
-
-
 #include <stdlib.h>
-
-static void prepare (GeglOperation *operation)
-{
-  gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
-}
-
-static gboolean
-process (GeglOperation       *operation,
-         GeglBuffer          *input,
-         GeglBuffer          *output,
-         const GeglRectangle *result)
-{
-  GeglOperationFilter *filter;
-  GeglChantOperation  *self;
-
-  filter = GEGL_OPERATION_FILTER (operation);
-  self   = GEGL_CHANT_OPERATION (operation);
-
-  {
-    GeglBuffer      *temp_in;
-    GeglRectangle    compute  = gegl_operation_compute_input_request (operation, "input", result);
-
-    if (self->radius < 1.0)
-      {
-        output = g_object_ref (input);
-      }
-    else
-      {
-        temp_in = gegl_buffer_create_sub_buffer (input, &compute);
-
-        max_envelope (temp_in, output, self->radius, self->samples, self->iterations, self->same_spray, self->rgamma);
-        g_object_unref (temp_in);
-      }
-  }
-
-  return  TRUE;
-}
-
 #include "envelopes.h"
 
 static void max_envelope (GeglBuffer *src,
@@ -94,7 +42,7 @@
                           gboolean    same_spray,
                           gdouble     rgamma)
 {
-  gint x,y;
+  gint    x, y;
   gfloat *src_buf;
   gfloat *dst_buf;
 
@@ -135,13 +83,60 @@
   g_free (dst_buf);
 }
 
+static void prepare (GeglOperation *operation)
+{
+  gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
+}
+
 static void tickle (GeglOperation *operation)
 {
   GeglOperationAreaFilter *area = GEGL_OPERATION_AREA_FILTER (operation);
-  GeglChantOperation      *filter = GEGL_CHANT_OPERATION (operation);
   area->left = area->right = area->top = area->bottom =
-  ceil (filter->radius);
+      ceil (GEGL_CHANT_PROPERTIES (operation)->radius);
 }
 
+static gboolean
+process (GeglOperation       *operation,
+         GeglBuffer          *input,
+         GeglBuffer          *output,
+         const GeglRectangle *result)
+{
+  GeglChantO   *o = GEGL_CHANT_PROPERTIES (operation);
+  GeglBuffer   *temp_in;
+  GeglRectangle compute = gegl_operation_compute_input_request (operation, "input", result);
+
+  if (o->radius < 1.0)
+    {
+      output = g_object_ref (input);
+    }
+  else
+    {
+      temp_in = gegl_buffer_create_sub_buffer (input, &compute);
+
+      max_envelope (temp_in, output, o->radius, o->samples, o->iterations, o->same_spray, o->rgamma);
+      g_object_unref (temp_in);
+    }
+
+  return  TRUE;
+}
+
+
+static void
+operation_class_init (GeglChantClass *klass)
+{
+  GeglOperationClass       *operation_class;
+  GeglOperationFilterClass *filter_class;
+
+  operation_class = GEGL_OPERATION_CLASS (klass);
+  filter_class    = GEGL_OPERATION_FILTER_CLASS (klass);
+
+  filter_class->process = process;
+  operation_class->prepare = prepare;
+  operation_class->tickle  = tickle;
+
+  operation_class->name        = "max-envelope";
+  operation_class->categories  = "enhance";
+  operation_class->description = "Maximum envelope as used by STRESS.";
+}
 
 #endif

Modified: trunk/operations/workshop/min-envelope.c
==============================================================================
--- trunk/operations/workshop/min-envelope.c	(original)
+++ trunk/operations/workshop/min-envelope.c	Sun Jan 27 01:31:27 2008
@@ -16,74 +16,22 @@
  * Copyright 2007 Ãyvind KolÃs     <pippin gimp org>
  */
 
-#if GEGL_CHANT_PROPERTIES
+#ifdef GEGL_CHANT_PROPERTIES
 
 gegl_chant_int (radius,     2, 5000.0, 50, "neighbourhood taken into account")
 gegl_chant_int (samples,    0, 1000,   3,  "number of samples to do")
 gegl_chant_int (iterations, 0, 1000.0, 20, "number of iterations (length of exposure)")
 gegl_chant_boolean (same_spray, FALSE, "")
 gegl_chant_double (rgamma, 0.0, 8.0, 1.8, "gamma applied to radial distribution")
-#else
 
-#define GEGL_CHANT_NAME         min_envelope
-#define GEGL_CHANT_SELF         "min-envelope.c"
-#define GEGL_CHANT_DESCRIPTION  "Minimum envelope, as used by STRESS."
-#define GEGL_CHANT_CATEGORIES   "enhance"
+#else
 
-#define GEGL_CHANT_AREA_FILTER
-#define GEGL_CHANT_PREPARE
+#define GEGL_CHANT_TYPE_AREA_FILTER
+#define GEGL_CHANT_C_FILE       "min-envelope.c"
 
-#include "gegl-old-chant.h"
+#include "gegl-chant.h"
 #include <math.h>
-
-static void min_envelope (GeglBuffer *src,
-                          GeglBuffer *dst,
-                          gint        radius,
-                          gint        samples,
-                          gint        iterations,
-                          gboolean    same_spray,
-                          gdouble     rgamma);
-
-
 #include <stdlib.h>
-
-static void prepare (GeglOperation *operation)
-{
-  gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
-}
-
-static gboolean
-process (GeglOperation       *operation,
-         GeglBuffer          *input,
-         GeglBuffer          *output,
-         const GeglRectangle *result)
-{
-  GeglOperationFilter *filter;
-  GeglChantOperation  *self;
-
-  filter = GEGL_OPERATION_FILTER (operation);
-  self   = GEGL_CHANT_OPERATION (operation);
-
-  {
-    GeglBuffer      *temp_in;
-    GeglRectangle    compute  = gegl_operation_compute_input_request (operation, "input", result);
-
-    if (self->radius < 1.0)
-      {
-        output = g_object_ref (input);
-      }
-    else
-      {
-        temp_in = gegl_buffer_create_sub_buffer (input, &compute);
-
-        min_envelope (temp_in, output, self->radius, self->samples, self->iterations, self->same_spray, self->rgamma);
-        g_object_unref (temp_in);
-      }
-  }
-
-  return  TRUE;
-}
-
 #include "envelopes.h"
 
 static void min_envelope (GeglBuffer *src,
@@ -94,7 +42,7 @@
                           gboolean    same_spray,
                           gdouble     rgamma)
 {
-  gint x,y;
+  gint    x, y;
   gfloat *src_buf;
   gfloat *dst_buf;
 
@@ -135,13 +83,59 @@
   g_free (dst_buf);
 }
 
+static void prepare (GeglOperation *operation)
+{
+  gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
+}
+
 static void tickle (GeglOperation *operation)
 {
   GeglOperationAreaFilter *area = GEGL_OPERATION_AREA_FILTER (operation);
-  GeglChantOperation      *filter = GEGL_CHANT_OPERATION (operation);
   area->left = area->right = area->top = area->bottom =
-  ceil (filter->radius);
+      ceil (GEGL_CHANT_PROPERTIES (operation)->radius);
 }
 
+static gboolean
+process (GeglOperation       *operation,
+         GeglBuffer          *input,
+         GeglBuffer          *output,
+         const GeglRectangle *result)
+{
+  GeglChantO   *o = GEGL_CHANT_PROPERTIES (operation);
+  GeglBuffer   *temp_in;
+  GeglRectangle compute  = gegl_operation_compute_input_request (operation, "input", result);
 
+  if (o->radius < 1.0)
+    {
+      output = g_object_ref (input);
+    }
+  else
+    {
+      temp_in = gegl_buffer_create_sub_buffer (input, &compute);
+
+      min_envelope (temp_in, output, o->radius, o->samples, o->iterations, o->same_spray, o->rgamma);
+      g_object_unref (temp_in);
+    }
+
+  return  TRUE;
+}
+
+
+static void
+operation_class_init (GeglChantClass *klass)
+{
+  GeglOperationClass       *operation_class;
+  GeglOperationFilterClass *filter_class;
+
+  operation_class = GEGL_OPERATION_CLASS (klass);
+  filter_class    = GEGL_OPERATION_FILTER_CLASS (klass);
+
+  filter_class->process = process;
+  operation_class->prepare = prepare;
+  operation_class->tickle  = tickle;
+
+  operation_class->name        = "min-envelope";
+  operation_class->categories  = "enhance";
+  operation_class->description = "Minimum envelope as used by STRESS.";
+}
 #endif

Modified: trunk/operations/workshop/snn-percentile.c
==============================================================================
--- trunk/operations/workshop/snn-percentile.c	(original)
+++ trunk/operations/workshop/snn-percentile.c	Sun Jan 27 01:31:27 2008
@@ -17,8 +17,7 @@
  *           2007 Ãyvind KolÃs <oeyvindk hig no>
  */
 
-#if GEGL_CHANT_PROPERTIES
-#define MAX_SAMPLES 20000 /* adapted to percentile level of radius */
+#ifdef GEGL_CHANT_PROPERTIES
 
 gegl_chant_double (radius, 0.0, 70.0, 8.0,
   "Radius of square pixel region, (width and height will be radius*2+1.")
@@ -28,64 +27,14 @@
 
 #else
 
-#define GEGL_CHANT_NAME        snn_percentile
-#define GEGL_CHANT_SELF        "snn-percentile.c"
-#define GEGL_CHANT_DESCRIPTION "Noise reducing edge enhancing percentile filter based on Symmetric Nearest Neighbours"
-#define GEGL_CHANT_CATEGORIES  "misc"
+#define MAX_SAMPLES 20000 /* adapted to percentile level of radius */
 
-#define GEGL_CHANT_AREA_FILTER
-#define GEGL_CHANT_PREPARE
+#define GEGL_CHANT_TYPE_AREA_FILTER
+#define GEGL_CHANT_C_FILE       "snn-percentile.c"
 
-#include "gegl-old-chant.h"
+#include "gegl-chant.h"
 #include <math.h>
 
-static void
-snn_percentile (GeglBuffer *src,
-                GeglBuffer *dst,
-                gdouble     radius,
-                gdouble     percentile,
-                gint        pairs);
-
-
-static void prepare (GeglOperation *operation)
-{
-  gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
-}
-
-
-static gboolean
-process (GeglOperation       *operation,
-         GeglBuffer          *input,
-         GeglBuffer          *output,
-         const GeglRectangle *result)
-{
-  GeglOperationFilter *filter;
-  GeglChantOperation  *self;
-
-  filter = GEGL_OPERATION_FILTER (operation);
-  self   = GEGL_CHANT_OPERATION (operation);
-
-    {
-      GeglBuffer          *temp_in;
-      GeglRectangle        compute  = gegl_operation_compute_input_request (operation, "input", result);
-
-      if (result->width == 0 ||
-          result->height== 0 ||
-          self->radius < 1.0)
-        {
-          output = g_object_ref (input);
-        }
-      else
-        {
-          temp_in = gegl_buffer_create_sub_buffer (input, &compute);
-          snn_percentile (temp_in, output, self->radius, self->percentile, self->pairs);
-          g_object_unref (temp_in);
-        }
-    }
-
-  return  TRUE;
-}
-
 #define RGB_LUMINANCE_RED    (0.212671)
 #define RGB_LUMINANCE_GREEN  (0.715160)
 #define RGB_LUMINANCE_BLUE   (0.072169)
@@ -262,12 +211,62 @@
   g_free (dst_buf);
 }
 
+static void prepare (GeglOperation *operation)
+{
+  gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
+}
+
 static void tickle (GeglOperation *operation)
 {
   GeglOperationAreaFilter *area = GEGL_OPERATION_AREA_FILTER (operation);
-  GeglChantOperation      *filter = GEGL_CHANT_OPERATION (operation);
   area->left = area->right = area->top = area->bottom =
-  ceil (filter->radius);
+      GEGL_CHANT_PROPERTIES (operation)->radius;
+}
+
+static gboolean
+process (GeglOperation       *operation,
+         GeglBuffer          *input,
+         GeglBuffer          *output,
+         const GeglRectangle *result)
+{
+  GeglChantO   *o = GEGL_CHANT_PROPERTIES (operation);
+  GeglBuffer   *temp_in;
+  GeglRectangle compute  = gegl_operation_compute_input_request (operation, "input", result);
+
+  if (result->width == 0 ||
+      result->height== 0 ||
+      o->radius < 1.0)
+    {
+      output = g_object_ref (input);
+    }
+  else
+    {
+      temp_in = gegl_buffer_create_sub_buffer (input, &compute);
+      snn_percentile (temp_in, output, o->radius, o->percentile, o->pairs);
+      g_object_unref (temp_in);
+    }
+
+  return  TRUE;
+}
+
+
+static void
+operation_class_init (GeglChantClass *klass)
+{
+  GeglOperationClass       *operation_class;
+  GeglOperationFilterClass *filter_class;
+
+  operation_class = GEGL_OPERATION_CLASS (klass);
+  filter_class    = GEGL_OPERATION_FILTER_CLASS (klass);
+
+  filter_class->process = process;
+  operation_class->prepare = prepare;
+  operation_class->tickle  = tickle;
+
+  operation_class->name        = "snn-percentile";
+  operation_class->categories  = "misc";
+  operation_class->description =
+        "Noise reducing edge enhancing percentile filter based on Symmetric Nearest Neighbours";
 }
 
 #endif

Modified: trunk/operations/workshop/stress.c
==============================================================================
--- trunk/operations/workshop/stress.c	(original)
+++ trunk/operations/workshop/stress.c	Sun Jan 27 01:31:27 2008
@@ -18,7 +18,7 @@
  *                Allesandro Rizzi <rizzi dti unimi it>
  */
 
-#if GEGL_CHANT_PROPERTIES
+#ifdef GEGL_CHANT_PROPERTIES
 
 gegl_chant_int (radius,     2, 5000.0, 300, "neighbourhood taken into account")
 gegl_chant_int (samples,    0, 1000,   10,    "number of samples to do")
@@ -27,56 +27,15 @@
 gegl_chant_double (rgamma, 0.0, 8.0, 2.0, "gamma applied to radial distribution")
 gegl_chant_double (strength, -10.0, 10.0, 1.0, "amoung of correction 0=none 1.0=full")
 gegl_chant_double (gamma, 0.0, 10.0, 1.0, "post correction gamma.")
-#else
-
-#define GEGL_CHANT_NAME         stress
-#define GEGL_CHANT_SELF         "stress.c"
-#define GEGL_CHANT_DESCRIPTION  "Spatio Temporal Retinex-like Envelope with Stochastic Sampling."
-#define GEGL_CHANT_CATEGORIES   "enhance"
 
-#define GEGL_CHANT_AREA_FILTER
+#else
 
-#define GEGL_CHANT_CLASS_INIT
+#define GEGL_CHANT_TYPE_AREA_FILTER
+#define GEGL_CHANT_C_FILE       "stress.c"
 
-#include "gegl-old-chant.h"
+#include "gegl-chant.h"
 #include <math.h>
-
-static void stress (GeglBuffer *src,
-                    GeglBuffer *dst,
-                    gint        radius,
-                    gint        samples,
-                    gint        iterations,
-                    gboolean    same_spray,
-                    gdouble     rgamma,
-                    gdouble     strength,
-                    gdouble     gamma);
-
 #include <stdlib.h>
-
-static gboolean
-process (GeglOperation       *operation,
-         GeglBuffer          *input,
-         GeglBuffer          *output,
-         const GeglRectangle *result)
-{
-  GeglOperationFilter *filter;
-  GeglChantOperation  *self;
-
-  filter = GEGL_OPERATION_FILTER (operation);
-  self   = GEGL_CHANT_OPERATION (operation);
-
-  stress (input, output,
-          self->radius,
-          self->samples,
-          self->iterations,
-          self->same_spray,
-          self->rgamma,
-          self->strength,
-          self->gamma);
-
-  return  TRUE;
-}
-
 #include "envelopes.h"
 
 static void stress (GeglBuffer *src,
@@ -154,9 +113,8 @@
 static void tickle (GeglOperation *operation)
 {
   GeglOperationAreaFilter *area = GEGL_OPERATION_AREA_FILTER (operation);
-  GeglChantOperation      *filter = GEGL_CHANT_OPERATION (operation);
   area->left = area->right = area->top = area->bottom =
-  ceil (filter->radius);
+      ceil (GEGL_CHANT_PROPERTIES (operation)->radius);
 }
 
 static GeglRectangle
@@ -170,14 +128,49 @@
   return *in_rect;
 }
 
-static void class_init (GeglOperationClass *operation_class)
+static gboolean
+process (GeglOperation       *operation,
+         GeglBuffer          *input,
+         GeglBuffer          *output,
+         const GeglRectangle *result)
 {
+  GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+
+  stress (input, output,
+          o->radius,
+          o->samples,
+          o->iterations,
+          o->same_spray,
+          o->rgamma,
+          o->strength,
+          o->gamma);
+
+  return  TRUE;
+}
+
+
+static void
+operation_class_init (GeglChantClass *klass)
+{
+  GeglOperationClass       *operation_class;
+  GeglOperationFilterClass *filter_class;
+
+  operation_class = GEGL_OPERATION_CLASS (klass);
+  filter_class    = GEGL_OPERATION_FILTER_CLASS (klass);
+
+  filter_class->process = process;
+  operation_class->tickle  = tickle;
   /* we override defined region to avoid growing the size of what is defined
-   * by the filter, this also allows the tricks used to treat alpha==0 pixels
+   * by the filter. This also allows the tricks used to treat alpha==0 pixels
    * in the image as source data not to be skipped by the stochastic sampling
    * yielding correct edge behavior.
    */
-  operation_class->get_defined_region  = get_defined_region;
+  operation_class->get_defined_region = get_defined_region;
+
+  operation_class->name        = "stress";
+  operation_class->categories  = "enhance";
+  operation_class->description =
+        "Spatio Temporal Retinex-like Envelope with Stochastic Sampling.";
 }
 
 #endif



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