Commit 08774c5e authored by Øyvind Kolås's avatar Øyvind Kolås

removed context argument from subclass specific process().

* 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).

svn path=/trunk/; revision=1996
parent 867e4d1c
2008-02-10 Øyvind Kolås <pippin@gimp.org>
* 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).
2008-02-10 Kevin Cozens <kcozens@cvs.gnome.org>
* operations/io/load-buffer.c:
......
......@@ -441,7 +441,6 @@ static gboolean process (GeglOperation *operation,
#else
#ifdef GEGL_CHANT_SOURCE
static gboolean process (GeglOperation *operation,
GeglNodeContext *context,
GeglBuffer *output,
const GeglRectangle *result);
#else
......
......@@ -104,6 +104,22 @@ const gchar * gegl_extension_handler_get (const gchar *extension);
#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 @@ struct _GeglOperationSourceClass
GeglOperationClass parent_class;
gboolean (* process) (GeglOperation *self,
GeglNodeContext *context,
GeglBuffer *output,
const GeglRectangle *result);
};
......
......@@ -134,7 +134,7 @@ process (GeglOperation *operation,
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;
}
......
......@@ -42,7 +42,6 @@ struct _GeglOperationSourceClass
GeglOperationClass parent_class;
gboolean (* process) (GeglOperation *self,
GeglNodeContext *context,
GeglBuffer *output,
const GeglRectangle *result);
};
......
......@@ -46,6 +46,22 @@ struct _GeglOperation
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 @@ struct _GeglOperationClass
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 @@ GeglNode * gegl_operation_get_source_node (GeglOperation *operation,
G_END_DECLS
/***
* foo:
*
*/
#endif /* __GEGL_OPERATION_H__ */
......@@ -603,7 +603,6 @@ query_exr (const gchar *path,
static gboolean
process (GeglOperation *operation,
GeglNodeContext *context,
GeglBuffer *output,
const GeglRectangle *result)
{
......
......@@ -344,7 +344,6 @@ decode_frame (GeglChantOperation *op,
static gboolean
process (GeglOperation *operation,
GeglNodeContext *context,
GeglBuffer *output,
const GeglRectangle *result)
{
......
......@@ -150,7 +150,6 @@ get_bounding_box (GeglOperation *operation)
static gboolean
process (GeglOperation *operation,
GeglNodeContext *context,
GeglBuffer *output,
const GeglRectangle *result)
{
......
......@@ -43,7 +43,7 @@ get_bounding_box (GeglOperation *operation)
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_init (GeglChantClass *klass)
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;
......
......@@ -107,7 +107,7 @@ get_bounding_box (GeglOperation *operation)
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_init (GeglChantClass *klass)
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";
......
......@@ -53,8 +53,7 @@ static void prepare (GeglOperation *operation)
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 @@ process (GeglOperation *operation,
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_init (GeglChantClass *klass)
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;
......
......@@ -373,7 +373,6 @@ get_bounding_box (GeglOperation *operation)
static gboolean
process (GeglOperation *operation,
GeglNodeContext *context,
GeglBuffer *output,
const GeglRectangle *result)
{
......
......@@ -119,13 +119,15 @@ get_bounding_box (GeglOperation *operation)
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_init (GeglChantClass *klass)
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";
......
......@@ -46,6 +46,10 @@ typedef struct
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 @@ get_bounding_box (GeglOperation *operation)
static gboolean
process (GeglOperation *operation,
GeglNodeContext *context,
GeglBuffer *output,
const GeglRectangle *result_foo)
{
......@@ -200,14 +203,6 @@ process (GeglOperation *operation,
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 @@ process (GeglOperation *operation,
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 @@ operation_class_init (GeglChantClass *klass)
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";
......
......@@ -52,7 +52,6 @@ get_bounding_box (GeglOperation *operation)
static gboolean
process (GeglOperation *operation,
GeglNodeContext *context,
GeglBuffer *output,
const GeglRectangle *result)
{
......
......@@ -49,7 +49,6 @@ detect (GeglOperation *operation,
static gboolean
process (GeglOperation *operation,
GeglNodeContext *context,
GeglBuffer *output,
const GeglRectangle *result)
{
......
......@@ -414,7 +414,6 @@ get_bounding_box (GeglOperation *operation)
static gboolean
process (GeglOperation *operation,
GeglNodeContext *context,
GeglBuffer *output,
const GeglRectangle *result)
{
......
......@@ -49,7 +49,7 @@ get_bounding_box (GeglOperation *operation)
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_init (GeglChantClass *klass)
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";
......
......@@ -47,7 +47,6 @@ get_bounding_box (GeglOperation *operation)
static gboolean
process (GeglOperation *operation,
GeglNodeContext *context,
GeglBuffer *output,
const GeglRectangle *result)
{
......
......@@ -164,7 +164,6 @@ static void text_layout_text (GeglChant *self,
static gboolean
process (GeglOperation *operation,
GeglNodeContext *context,
GeglBuffer *output,
const GeglRectangle *result)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment