[gimp/soc-2010-cage] Cage transform gegl op: now correctly iterate and fill with a color
- From: Michael Muré <mmure src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/soc-2010-cage] Cage transform gegl op: now correctly iterate and fill with a color
- Date: Tue, 13 Jul 2010 14:12:19 +0000 (UTC)
commit 279f5d34f297698003b4a32942bd0a3ed0f43b4d
Author: Michael Muré <batolettre gmail com>
Date: Mon Jul 12 23:17:03 2010 +0200
Cage transform gegl op: now correctly iterate and fill with a color
app/gegl/gimp-gegl.c | 2 ++
app/gegl/gimpoperationcage.c | 39 +++++++++++++++++++++++++++------------
app/gegl/gimpoperationcage.h | 2 +-
3 files changed, 30 insertions(+), 13 deletions(-)
---
diff --git a/app/gegl/gimp-gegl.c b/app/gegl/gimp-gegl.c
index 7d7b86b..33fa36c 100644
--- a/app/gegl/gimp-gegl.c
+++ b/app/gegl/gimp-gegl.c
@@ -31,6 +31,7 @@
#include "core/gimp.h"
#include "gimp-gegl.h"
+#include "gimpoperationcage.h"
#include "gimpoperationcolorbalance.h"
#include "gimpoperationcolorize.h"
#include "gimpoperationcurves.h"
@@ -95,6 +96,7 @@ gimp_gegl_init (Gimp *gimp)
g_type_class_ref (GIMP_TYPE_OPERATION_TILE_SINK);
g_type_class_ref (GIMP_TYPE_OPERATION_TILE_SOURCE);
+ g_type_class_ref (GIMP_TYPE_OPERATION_CAGE);
g_type_class_ref (GIMP_TYPE_OPERATION_COLOR_BALANCE);
g_type_class_ref (GIMP_TYPE_OPERATION_COLORIZE);
g_type_class_ref (GIMP_TYPE_OPERATION_CURVES);
diff --git a/app/gegl/gimpoperationcage.c b/app/gegl/gimpoperationcage.c
index 3214cba..1efe2de 100644
--- a/app/gegl/gimpoperationcage.c
+++ b/app/gegl/gimpoperationcage.c
@@ -32,16 +32,17 @@
#include "gimpoperationcage.h"
-static gboolean gimp_operation_cage_process (GeglOperation *operation,
- GeglBuffer *in_buf,
- GeglBuffer *out_buf,
- const GeglRectangle *roi);
+static gboolean gimp_operation_cage_process (GeglOperation *operation,
+ GeglBuffer *in_buf,
+ GeglBuffer *out_buf,
+ const GeglRectangle *roi);
+static void gimp_operation_cage_prepare (GeglOperation *operation);
G_DEFINE_TYPE (GimpOperationCage, gimp_operation_cage,
GEGL_TYPE_OPERATION_FILTER)
-//#define parent_class gimp_operation_cage_parent_class
+#define parent_class gimp_operation_cage_parent_class
static void
@@ -53,9 +54,13 @@ gimp_operation_cage_class_init (GimpOperationCageClass *klass)
operation_class = GEGL_OPERATION_CLASS (klass);
filter_class = GEGL_OPERATION_FILTER_CLASS (klass);
- operation_class->name = "gimp:cage";
+ //FIXME: wrong categories and name, to appears in the gegl tool
+ operation_class->name = "gegl:cage";
+ operation_class->categories = "color";
operation_class->description = "GIMP cage transform";
+ operation_class->prepare = gimp_operation_cage_prepare;
+
filter_class->process = gimp_operation_cage_process;
}
@@ -71,7 +76,7 @@ gimp_operation_cage_process (GeglOperation *operation,
const GeglRectangle *roi)
{
GeglBufferIterator *i;
- Babl *format = babl_format ("RaGaBaA float");
+ Babl *format = babl_format ("RGBA float");
i = gegl_buffer_iterator_new (out_buf, roi, format, GEGL_BUFFER_WRITE);
@@ -83,13 +88,16 @@ gimp_operation_cage_process (GeglOperation *operation,
gint x = i->roi->x; /* initial x */
gint y = i->roi->y; /* and y coordinates */
+ gfloat *dest = i->data[0];
+
while(n_pixels--)
{
- gfloat *buf = i->data[0];
- buf[0] = 0.5;
- buf[1] = 0.5;
- buf[2] = 0.5;
- buf[3] = 0.5;
+ dest[RED] = 1.0;
+ dest[GREEN] = 0.0;
+ dest[BLUE] = 1.0;
+ dest[ALPHA] = 1.0;
+
+ dest += 4;
/* update x and y coordinates */
x++;
@@ -103,3 +111,10 @@ gimp_operation_cage_process (GeglOperation *operation,
}
return TRUE;
}
+
+static void
+gimp_operation_cage_prepare (GeglOperation *operation)
+{
+ gegl_operation_set_format (operation, "input", babl_format ("RGBA float"));
+ gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
+}
\ No newline at end of file
diff --git a/app/gegl/gimpoperationcage.h b/app/gegl/gimpoperationcage.h
index 544166d..ea7c7d6 100644
--- a/app/gegl/gimpoperationcage.h
+++ b/app/gegl/gimpoperationcage.h
@@ -40,7 +40,7 @@ struct _GimpOperationCage
struct _GimpOperationCageClass
{
- GeglOperationFilter parent_class;
+ GeglOperationFilterClass parent_class;
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]