gegl r1996 - in trunk: . gegl gegl/operation operations/io operations/render



Author: ok
Date: Mon Feb 11 00:01:14 2008
New Revision: 1996
URL: http://svn.gnome.org/viewvc/gegl?rev=1996&view=rev

Log:
* gegl/operation/gegl-operation-source.[ch]: removed context argument
from subclass specific process().
* gegl/operation/gegl-operation.h: documentation++.
* gegl/gegl-plugin.h: updated duplicated bits from headers.
* gegl/gegl-old-chant.h: updated to reflect changes in API (note that
the new gegl-chant.h didn't need changes when the classes used change
:)).
* operations/render/checkerboard.c:
* operations/render/color.c:
* operations/render/fractal-explorer.c:
* operations/render/noise.c:
* operations/render/text.c:
* operations/io/jpg-load.c:
* operations/io/ff-load.c:
* operations/io/exr-load.cpp:
* operations/io/png-load.c: updated to new api.
* operations/io/svg-load.c: request the pixelformat in prepare,
updated to new api.
* operations/io/raw-load.c:
* operations/io/load-buffer.c:
* operations/io/magick-load.c:
* operations/render/introspect.c:
* operations/io/pixbuf.c: override the process of GeglOperation
directly, since these chear and don't write into a provided buffer
(if possible, this should be changed).


Modified:
   trunk/ChangeLog
   trunk/gegl/gegl-old-chant.h
   trunk/gegl/gegl-plugin.h
   trunk/gegl/operation/gegl-operation-source.c
   trunk/gegl/operation/gegl-operation-source.h
   trunk/gegl/operation/gegl-operation.h
   trunk/operations/io/exr-load.cpp
   trunk/operations/io/ff-load.c
   trunk/operations/io/jpg-load.c
   trunk/operations/io/load-buffer.c
   trunk/operations/io/magick-load.c
   trunk/operations/io/pixbuf.c
   trunk/operations/io/png-load.c
   trunk/operations/io/raw-load.c
   trunk/operations/io/svg-load.c
   trunk/operations/render/checkerboard.c
   trunk/operations/render/color.c
   trunk/operations/render/fractal-explorer.c
   trunk/operations/render/introspect.c
   trunk/operations/render/noise.c
   trunk/operations/render/text.c

Modified: trunk/gegl/gegl-old-chant.h
==============================================================================
--- trunk/gegl/gegl-old-chant.h	(original)
+++ trunk/gegl/gegl-old-chant.h	Mon Feb 11 00:01:14 2008
@@ -441,7 +441,6 @@
 #else
 #ifdef GEGL_CHANT_SOURCE
 static gboolean process (GeglOperation       *operation,
-                         GeglNodeContext     *context,
                          GeglBuffer          *output,
                          const GeglRectangle *result);
 #else

Modified: trunk/gegl/gegl-plugin.h
==============================================================================
--- trunk/gegl/gegl-plugin.h	(original)
+++ trunk/gegl/gegl-plugin.h	Mon Feb 11 00:01:14 2008
@@ -104,6 +104,22 @@
 #include <glib-object.h>
 #include <babl/babl.h>
 
+
+/***
+ * GeglOperation:
+ * 
+ * All the image processing code in GEGL is implemented as GeglOperations,
+ * GEGL oeprations are implemented as GObject with a convenience API called
+ * chanting that abstracts away the boiler plater needed to generate introspectable
+ * named properties of different types.
+ *
+ * Most types of operations like: filters, composers, sources, sinks, point
+ * operations, compositing operations, and spatial operations with fixed
+ * neighbourhoods. These base classes builds on top of the GeglOperationsClass:
+ *
+ * See <a href='gegl-operation.h.html'>gegl-operation.h</a> for details.
+ */
+
 #define GEGL_TYPE_OPERATION            (gegl_operation_get_type ())
 #define GEGL_OPERATION(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEGL_TYPE_OPERATION, GeglOperation))
 #define GEGL_OPERATION_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  GEGL_TYPE_OPERATION, GeglOperationClass))
@@ -280,7 +296,6 @@
   GeglOperationClass parent_class;
 
   gboolean (* process) (GeglOperation       *self,
-                        GeglNodeContext     *context,
                         GeglBuffer          *output,
                         const GeglRectangle *result);
 };

Modified: trunk/gegl/operation/gegl-operation-source.c
==============================================================================
--- trunk/gegl/operation/gegl-operation-source.c	(original)
+++ trunk/gegl/operation/gegl-operation-source.c	Mon Feb 11 00:01:14 2008
@@ -134,7 +134,7 @@
 
   g_assert (klass->process);
   output = gegl_node_context_get_target (context, "output");
-  success = klass->process (operation, context, output, result);
+  success = klass->process (operation, output, result);
 
   return success;
 }

Modified: trunk/gegl/operation/gegl-operation-source.h
==============================================================================
--- trunk/gegl/operation/gegl-operation-source.h	(original)
+++ trunk/gegl/operation/gegl-operation-source.h	Mon Feb 11 00:01:14 2008
@@ -42,7 +42,6 @@
   GeglOperationClass parent_class;
 
   gboolean (* process) (GeglOperation       *self,
-                        GeglNodeContext     *context,
                         GeglBuffer          *output,
                         const GeglRectangle *result);
 };

Modified: trunk/gegl/operation/gegl-operation.h
==============================================================================
--- trunk/gegl/operation/gegl-operation.h	(original)
+++ trunk/gegl/operation/gegl-operation.h	Mon Feb 11 00:01:14 2008
@@ -46,6 +46,22 @@
                       with through */
 };
 
+
+/***
+ * GeglOperation:
+ * 
+ * All the image processing code in GEGL is implemented as GeglOperations,
+ * GEGL oeprations are implemented as GObject with a convenience API called
+ * chanting that abstracts away the boiler plater needed to generate introspectable
+ * named properties of different types.
+ *
+ * Most types of operations like: filters, composers, sources, sinks, point
+ * operations, compositing operations, and spatial operations with fixed
+ * neighbourhoods. These base classes builds on top of the GeglOperationsClass:
+ *
+ * See <a href='gegl-plugin.h.html'>gegl-plugin.h</a> for details.
+ */
+
 struct _GeglOperationClass
 {
   GObjectClass    parent_class;
@@ -57,7 +73,8 @@
 
   gboolean        no_cache;    /* do not create a cache for this operation */
 
-  /* attach this operation with a GeglNode, override this if you are creating a
+  /*
+   * attach this operation with a GeglNode, override this if you are creating a
    * GeglGraph, it is already defined for Filters/Sources/Composers.
    */
   void          (*attach)                    (GeglOperation *operation);
@@ -186,4 +203,9 @@
 
 G_END_DECLS
 
+/***
+ * foo:
+ *
+ */
+
 #endif /* __GEGL_OPERATION_H__ */

Modified: trunk/operations/io/exr-load.cpp
==============================================================================
--- trunk/operations/io/exr-load.cpp	(original)
+++ trunk/operations/io/exr-load.cpp	Mon Feb 11 00:01:14 2008
@@ -603,7 +603,6 @@
 
 static gboolean
 process (GeglOperation       *operation,
-         GeglNodeContext     *context,
          GeglBuffer          *output,
          const GeglRectangle *result)
 {

Modified: trunk/operations/io/ff-load.c
==============================================================================
--- trunk/operations/io/ff-load.c	(original)
+++ trunk/operations/io/ff-load.c	Mon Feb 11 00:01:14 2008
@@ -344,7 +344,6 @@
 
 static gboolean
 process (GeglOperation       *operation,
-         GeglNodeContext     *context,
          GeglBuffer          *output,
          const GeglRectangle *result)
 {

Modified: trunk/operations/io/jpg-load.c
==============================================================================
--- trunk/operations/io/jpg-load.c	(original)
+++ trunk/operations/io/jpg-load.c	Mon Feb 11 00:01:14 2008
@@ -150,7 +150,6 @@
 
 static gboolean
 process (GeglOperation       *operation,
-         GeglNodeContext     *context,
          GeglBuffer          *output,
          const GeglRectangle *result)
 {

Modified: trunk/operations/io/load-buffer.c
==============================================================================
--- trunk/operations/io/load-buffer.c	(original)
+++ trunk/operations/io/load-buffer.c	Mon Feb 11 00:01:14 2008
@@ -43,7 +43,7 @@
 static gboolean
 process (GeglOperation       *operation,
          GeglNodeContext     *context,
-         GeglBuffer          *output,
+         const gchar         *output_pad,
          const GeglRectangle *result)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
@@ -84,7 +84,7 @@
   operation_class = GEGL_OPERATION_CLASS (klass);
   source_class    = GEGL_OPERATION_SOURCE_CLASS (klass);
 
-  source_class->process = process;
+  operation_class->process = process;
   operation_class->get_bounding_box = get_bounding_box;
 
   G_OBJECT_CLASS (klass)->dispose = dispose;

Modified: trunk/operations/io/magick-load.c
==============================================================================
--- trunk/operations/io/magick-load.c	(original)
+++ trunk/operations/io/magick-load.c	Mon Feb 11 00:01:14 2008
@@ -107,7 +107,7 @@
 static gboolean
 process (GeglOperation       *operation,
          GeglNodeContext     *context,
-         GeglBuffer          *output,
+         const gchar         *output_pad,
          const GeglRectangle *result)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
@@ -132,7 +132,7 @@
   operation_class = GEGL_OPERATION_CLASS (klass);
   source_class    = GEGL_OPERATION_SOURCE_CLASS (klass);
 
-  source_class->process = process;
+  operation_class->process = process;
   operation_class->get_bounding_box = get_bounding_box;
 
   operation_class->name        = "magick-load";

Modified: trunk/operations/io/pixbuf.c
==============================================================================
--- trunk/operations/io/pixbuf.c	(original)
+++ trunk/operations/io/pixbuf.c	Mon Feb 11 00:01:14 2008
@@ -53,8 +53,7 @@
 
 static gboolean
 process (GeglOperation       *operation,
-         GeglNodeContext     *context,
-         GeglBuffer          *output,  /* ignored */
+         GeglBuffer          *output,
          const GeglRectangle *result)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
@@ -64,11 +63,8 @@
       GeglRectangle extent = {0,0,
                               gdk_pixbuf_get_width (o->pixbuf),
                               gdk_pixbuf_get_height (o->pixbuf)};
-      /*GeglBuffer *output = gegl_buffer_new (&extent,
-      babl_format(gdk_pixbuf_get_has_alpha(o->pixbuf)?"R'G'B'A u8":"R'G'B' u8"));*/
-      gegl_buffer_set (output, NULL, NULL, gdk_pixbuf_get_pixels (o->pixbuf),
+      gegl_buffer_set (output, &extent, NULL, gdk_pixbuf_get_pixels (o->pixbuf),
                        GEGL_AUTO_ROWSTRIDE);
-      /*gegl_node_context_set_object (context, "output", G_OBJECT (output));*/
     }
   return TRUE;
 }
@@ -83,7 +79,6 @@
   operation_class = GEGL_OPERATION_CLASS (klass);
   source_class    = GEGL_OPERATION_SOURCE_CLASS (klass);
 
-  /*source_class->process = process;*/
   source_class->process = process;
   operation_class->get_bounding_box = get_bounding_box;
   operation_class->prepare = prepare;

Modified: trunk/operations/io/png-load.c
==============================================================================
--- trunk/operations/io/png-load.c	(original)
+++ trunk/operations/io/png-load.c	Mon Feb 11 00:01:14 2008
@@ -373,7 +373,6 @@
 
 static gboolean
 process (GeglOperation       *operation,
-         GeglNodeContext     *context,
          GeglBuffer          *output,
          const GeglRectangle *result)
 {

Modified: trunk/operations/io/raw-load.c
==============================================================================
--- trunk/operations/io/raw-load.c	(original)
+++ trunk/operations/io/raw-load.c	Mon Feb 11 00:01:14 2008
@@ -119,13 +119,15 @@
 static gboolean
 process (GeglOperation       *operation,
          GeglNodeContext     *context,
-         GeglBuffer          *output_ignored,
+         const gchar         *output_pad,
          const GeglRectangle *result)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
   GeglBuffer *output;
 
   g_assert (o->chant_data);
+  g_assert (g_str_equal (output_pad, "output"));
+
   output = GEGL_BUFFER (o->chant_data);
   gegl_node_context_set_object (context, "output", G_OBJECT (output));
 
@@ -143,7 +145,7 @@
   operation_class = GEGL_OPERATION_CLASS (klass);
   source_class    = GEGL_OPERATION_SOURCE_CLASS (klass);
 
-  source_class->process = process;
+  operation_class->process = process;
   operation_class->get_bounding_box = get_bounding_box;
 
   operation_class->name        = "raw-load";

Modified: trunk/operations/io/svg-load.c
==============================================================================
--- trunk/operations/io/svg-load.c	(original)
+++ trunk/operations/io/svg-load.c	Mon Feb 11 00:01:14 2008
@@ -46,6 +46,10 @@
   gint       height;
 } SvgLoadVals;
 
+static void prepare (GeglOperation *operation)
+{
+  gegl_operation_set_format (operation, "output", babl_format ("R'G'B'A u8"));
+}
 
 static gint
 gegl_buffer_import_svg (GeglBuffer  *gegl_buffer,
@@ -181,7 +185,6 @@
 
 static gboolean
 process (GeglOperation       *operation,
-         GeglNodeContext     *context,
          GeglBuffer          *output,
          const GeglRectangle *result_foo)
 {
@@ -200,14 +203,6 @@
             return TRUE;
       }
 
-      {
-        GeglRectangle extent={0,0,width,height};
-        /* FIXME: the format should be set on the pad prior to the actual
-         * load
-         */
-        output = gegl_buffer_new (&extent, babl_format ("R'G'B'A u8"));
-      }
-
   result = gegl_buffer_import_svg (output, o->path,
                                    width, height, 0, 0, &width, &height);
   if (result)
@@ -216,7 +211,6 @@
         G_OBJECT_TYPE_NAME (operation), o->path);
       return  FALSE;
     }
-  gegl_node_context_set_object (context, "output", G_OBJECT (output));
 
   return  TRUE;
 }
@@ -232,6 +226,7 @@
   source_class    = GEGL_OPERATION_SOURCE_CLASS (klass);
 
   source_class->process = process;
+  operation_class->prepare = prepare;
   operation_class->get_bounding_box = get_bounding_box;
 
   operation_class->name        = "svg-load";

Modified: trunk/operations/render/checkerboard.c
==============================================================================
--- trunk/operations/render/checkerboard.c	(original)
+++ trunk/operations/render/checkerboard.c	Mon Feb 11 00:01:14 2008
@@ -52,7 +52,6 @@
 
 static gboolean
 process (GeglOperation       *operation,
-         GeglNodeContext     *context,
          GeglBuffer          *output,
          const GeglRectangle *result)
 {

Modified: trunk/operations/render/color.c
==============================================================================
--- trunk/operations/render/color.c	(original)
+++ trunk/operations/render/color.c	Mon Feb 11 00:01:14 2008
@@ -49,7 +49,6 @@
 
 static gboolean
 process (GeglOperation       *operation,
-         GeglNodeContext     *context,
          GeglBuffer          *output,
          const GeglRectangle *result)
 {

Modified: trunk/operations/render/fractal-explorer.c
==============================================================================
--- trunk/operations/render/fractal-explorer.c	(original)
+++ trunk/operations/render/fractal-explorer.c	Mon Feb 11 00:01:14 2008
@@ -414,7 +414,6 @@
 
 static gboolean
 process (GeglOperation       *operation,
-         GeglNodeContext     *context,
          GeglBuffer          *output,
          const GeglRectangle *result)
 {

Modified: trunk/operations/render/introspect.c
==============================================================================
--- trunk/operations/render/introspect.c	(original)
+++ trunk/operations/render/introspect.c	Mon Feb 11 00:01:14 2008
@@ -49,7 +49,7 @@
 static gboolean
 process (GeglOperation       *operation,
          GeglNodeContext     *context,
-         GeglBuffer          *output, /* ignored */
+         const gchar         *output_pad,
          const GeglRectangle *result)
 {
   GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
@@ -113,7 +113,7 @@
   operation_class = GEGL_OPERATION_CLASS (klass);
   source_class    = GEGL_OPERATION_SOURCE_CLASS (klass);
 
-  source_class->process = process;
+  operation_class->process = process;
   operation_class->get_bounding_box = get_bounding_box;
 
   operation_class->name        = "introspect";

Modified: trunk/operations/render/noise.c
==============================================================================
--- trunk/operations/render/noise.c	(original)
+++ trunk/operations/render/noise.c	Mon Feb 11 00:01:14 2008
@@ -47,7 +47,6 @@
 
 static gboolean
 process (GeglOperation       *operation,
-         GeglNodeContext     *context,
          GeglBuffer          *output,
          const GeglRectangle *result)
 {

Modified: trunk/operations/render/text.c
==============================================================================
--- trunk/operations/render/text.c	(original)
+++ trunk/operations/render/text.c	Mon Feb 11 00:01:14 2008
@@ -164,7 +164,6 @@
 
 static gboolean
 process (GeglOperation       *operation,
-         GeglNodeContext     *context,
          GeglBuffer          *output,
          const GeglRectangle *result)
 {



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