Commit 76db4b27 authored by Øyvind Kolås's avatar Øyvind Kolås

Ported rendering operations to use gegl_operation_get_target() to

aquire the destination buffer instead of creating it in the plug-in
code.
* operations/render/FractalExplorer.c:
* operations/render/checkerboard.c:
* operations/render/color.c:
* operations/render/introspect.c:
* operations/render/noise.c:
* operations/render/text.c:

svn path=/trunk/; revision=1495
parent 3148bdb8
2007-05-22 Øyvind Kolås <pippin@gimp.org>
Ported rendering operations to use gegl_operation_get_target() to
aquire the destination buffer instead of creating it in the plug-in
code.
* operations/render/FractalExplorer.c:
* operations/render/checkerboard.c:
* operations/render/color.c:
* operations/render/introspect.c:
* operations/render/noise.c:
* operations/render/text.c:
2007-05-22 Øyvind Kolås <pippin@gimp.org>
Ported operations to use gegl_operation_get_target() to aquire the
......
......@@ -54,13 +54,15 @@ gegl_chant_boolean (useloglog, FALSE, "Use loglog smoothing")
#else
#define GEGL_CHANT_SOURCE
#define GEGL_CHANT_NAME FractalExplorer
#define GEGL_CHANT_DESCRIPTION "Fractal Explorer"
#define GEGL_CHANT_SELF "FractalExplorer.c"
#define GEGL_CHANT_DESCRIPTION "Fractal Explorer"
#define GEGL_CHANT_CATEGORIES "render"
#define GEGL_CHANT_SOURCE
#define GEGL_CHANT_PREPARE
#include "gegl-chant.h"
#include <math.h>
#include <stdio.h>
......@@ -400,13 +402,7 @@ process (GeglOperation *operation,
make_color_map (self, colormap);
output = g_object_new (GEGL_TYPE_BUFFER,
"format", babl_format ("R'G'B' u8"),
"x", result->x,
"y", result->y,
"width", result->width ,
"height", result->height,
NULL);
output = GEGL_BUFFER (gegl_operation_get_target (operation, context_id, "output"));
buf = g_new (guchar, result->width * result->height * 4);
{
......@@ -426,10 +422,16 @@ process (GeglOperation *operation,
gegl_buffer_set (output, NULL, babl_format ("R'G'B' u8"), buf);
g_free (buf);
}
gegl_operation_set_data (operation, context_id, "output", G_OBJECT (output));
return TRUE;
}
static void
prepare (GeglOperation *operation,
gpointer context_id)
{
gegl_operation_set_format (operation, "output", babl_format ("R'G'B' u8"));
}
static GeglRectangle
get_defined_region (GeglOperation *operation)
{
......
......@@ -34,8 +34,17 @@ gegl_chant_color (color2, "white", "The other cell color (defa
#define GEGL_CHANT_SELF "checkerboard.c"
#define GEGL_CHANT_CATEGORIES "render"
#define GEGL_CHANT_PREPARE
#include "gegl-chant.h"
static void
prepare (GeglOperation *operation,
gpointer context_id)
{
gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
}
static gboolean
process (GeglOperation *operation,
gpointer context_id)
......@@ -75,6 +84,7 @@ process (GeglOperation *operation,
"width", result->width ,
"height", result->height,
NULL);
output = GEGL_BUFFER (gegl_operation_get_target (operation, context_id, "output"));
g_object_get (output, "px-size", &pxsize,
"pixels", &n_pixels,
......@@ -104,7 +114,6 @@ process (GeglOperation *operation,
gegl_buffer_set (output, NULL, NULL, buf);
g_free (buf);
}
gegl_operation_set_data (operation, context_id, "output", G_OBJECT (output));
return TRUE;
}
......
......@@ -28,9 +28,19 @@ gegl_chant_color (value, "black", "One of the cell colors (defaults to 'black')"
#define GEGL_CHANT_SELF "color.c"
#define GEGL_CHANT_CATEGORIES "render"
#define GEGL_CHANT_CLASS_INIT
#define GEGL_CHANT_PREPARE
#include "gegl-chant.h"
static void
prepare (GeglOperation *operation,
gpointer context_id)
{
gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
}
static gboolean
process (GeglOperation *operation,
gpointer context_id)
......@@ -51,14 +61,7 @@ process (GeglOperation *operation,
&color[2],
&color[3]);
output = g_object_new (GEGL_TYPE_BUFFER,
"format",
babl_format ("RGBA float"),
"x", result->x,
"y", result->y,
"width", result->width ,
"height", result->height,
NULL);
output = GEGL_BUFFER (gegl_operation_get_target (operation, context_id, "output"));
buf = g_malloc (result->width * result->height * 4 * sizeof (gfloat));
{
gfloat *dst=buf;
......@@ -72,7 +75,6 @@ process (GeglOperation *operation,
gegl_buffer_set (output, NULL, NULL, buf);
g_free (buf);
}
gegl_operation_set_data (operation, context_id, "output", G_OBJECT (output));
return TRUE;
}
......
......@@ -24,12 +24,12 @@ gegl_chant_pointer(buf, "Buffer")
#else
#define GEGL_CHANT_SOURCE
#define GEGL_CHANT_NAME introspect
#define GEGL_CHANT_DESCRIPTION "GEGL graph vizualizer."
#define GEGL_CHANT_SELF "introspect.c"
#define GEGL_CHANT_DESCRIPTION "GEGL graph vizualizer."
#define GEGL_CHANT_CATEGORIES "render"
#define GEGL_CHANT_SOURCE
#include "gegl-chant.h"
......@@ -68,6 +68,8 @@ process (GeglOperation *operation,
g_free (dot);
}
/* FIXME: copy behavior from magick-load to fix this op */
{
GeglNode *gegl = gegl_node_new ();
......
......@@ -27,12 +27,15 @@ gegl_chant_double (n, 0, 20.0, 3.0, "")
#else
#define GEGL_CHANT_SOURCE
#define GEGL_CHANT_NAME perlin_noise
#define GEGL_CHANT_DESCRIPTION "Perlin noise generator."
#define GEGL_CHANT_SELF "noise.c"
#define GEGL_CHANT_DESCRIPTION "Perlin noise generator."
#define GEGL_CHANT_CATEGORIES "render"
#define GEGL_CHANT_SOURCE
#define GEGL_CHANT_PREPARE
#include "gegl-chant.h"
#include "perlin/perlin.c"
#include "perlin/perlin.h"
......@@ -51,14 +54,7 @@ process (GeglOperation *operation,
GeglRectangle *result = gegl_operation_result_rect (operation, context_id);
gfloat *buf;
output = g_object_new (GEGL_TYPE_BUFFER,
"format",
babl_format ("Y float"),
"x", result->x,
"y", result->y,
"width", result->width ,
"height", result->height,
NULL);
output = GEGL_BUFFER (gegl_operation_get_target (operation, context_id, "output"));
buf = g_malloc (result->width * result->height * 4);
{
gfloat *dst=buf;
......@@ -82,10 +78,15 @@ process (GeglOperation *operation,
gegl_buffer_set (output, NULL, babl_format ("Y float"), buf);
g_free (buf);
}
gegl_operation_set_data (operation, context_id, "output", G_OBJECT (output));
return TRUE;
}
static void
prepare (GeglOperation *operation,
gpointer context_id)
{
gegl_operation_set_format (operation, "output", babl_format ("Y float"));
}
static GeglRectangle
get_defined_region (GeglOperation *operation)
......
......@@ -37,12 +37,16 @@ gegl_chant_int (height, 0, 1000000, 0,
#else
#define GEGL_CHANT_NAME text
#define GEGL_CHANT_DESCRIPTION "Display a string of text using pango and cairo."
#define GEGL_CHANT_SELF "text.c"
#define GEGL_CHANT_CATEGORIES "render"
#define GEGL_CHANT_SOURCE
#define GEGL_CHANT_NAME text
#define GEGL_CHANT_DESCRIPTION "Display a string of text using pango and cairo."
#define GEGL_CHANT_SELF "text.c"
#define GEGL_CHANT_CATEGORIES "render"
#define GEGL_CHANT_PREPARE
#define GEGL_CHANT_CLASS_INIT
#include "gegl-chant.h"
#include <cairo.h>
......@@ -156,14 +160,7 @@ process (GeglOperation *operation,
result = gegl_operation_result_rect (operation, context_id);
output = g_object_new (GEGL_TYPE_BUFFER,
"format", babl_format ("B'aG'aR'aA u8"),
"x", result->x,
"y", result->y,
"width", result->width ,
"height", result->height,
NULL);
output = GEGL_BUFFER (gegl_operation_get_target (operation, context_id, "output"));
{
guchar *data = g_malloc0 (result->width * result->height * 4);
cairo_t *cr;
......@@ -181,7 +178,6 @@ process (GeglOperation *operation,
cairo_surface_destroy (surface);
g_free (data);
}
gegl_operation_set_data (operation, context_id, "output", G_OBJECT (output));
return TRUE;
}
......@@ -257,6 +253,13 @@ finalize (GObject *object)
G_OBJECT_CLASS (g_type_class_peek_parent (G_OBJECT_GET_CLASS (object)))->finalize (object);
}
static void
prepare (GeglOperation *operation,
gpointer context_id)
{
gegl_operation_set_format (operation, "output", babl_format ("B'aG'aR'aA u8"));
}
static void class_init (GeglOperationClass *klass)
{
G_OBJECT_CLASS (klass)->finalize = finalize;
......
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