[gegl] make ops use gegl-op.h
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] make ops use gegl-op.h
- Date: Sat, 17 May 2014 17:29:36 +0000 (UTC)
commit 01e107bf34bb674b8dc9a2e131d98ee5fb4507bc
Author: Øyvind Kolås <pippin gimp org>
Date: Sat May 17 18:08:50 2014 +0200
make ops use gegl-op.h
motion-blur-linear.c mono-mixer mirrors mblur matting-global map-relative
map-absolute manituk06 magick-load load linear-gradient.c levels
lends-distortion introspect
operations/common/introspect.c | 42 ++++++------
operations/common/lens-distortion.c | 101 +++++++++++++++-------------
operations/common/levels.c | 42 +++++++-----
operations/common/linear-gradient.c | 62 ++++++++++++------
operations/common/load.c | 32 +++++----
operations/common/magick-load.c | 43 +++++++------
operations/common/mantiuk06.c | 39 ++++++-----
operations/common/map-absolute.c | 17 +++--
operations/common/map-relative.c | 30 +++++----
operations/common/matting-global.c | 17 +++--
operations/common/mblur.c | 45 +++++++------
operations/common/mirrors.c | 113 +++++++++++++++++++++----------
operations/common/mono-mixer.c | 42 +++++++-----
operations/common/motion-blur-linear.c | 38 ++++++-----
14 files changed, 384 insertions(+), 279 deletions(-)
---
diff --git a/operations/common/introspect.c b/operations/common/introspect.c
index 19e0f10..8ee2c42 100644
--- a/operations/common/introspect.c
+++ b/operations/common/introspect.c
@@ -21,23 +21,25 @@
#include <glib/gi18n-lib.h>
-#ifdef GEGL_CHANT_PROPERTIES
+#ifdef GEGL_PROPERTIES
-gegl_chant_object(node, _("Node"), _("GeglNode to introspect"))
+gegl_property_object(node, _("Node"),
+ "description", _("GeglNode to introspect"),
+ NULL)
#else
-#define GEGL_CHANT_TYPE_SOURCE
-#define GEGL_CHANT_C_FILE "introspect.c"
+#define GEGL_OP_SOURCE
+#define GEGL_OP_C_FILE "introspect.c"
-#include "gegl-chant.h"
+#include "gegl-op.h"
#include "gegl-types-internal.h"
#include "gegl-dot.h" /* XXX: internal header file */
#include <stdio.h>
static void
-gegl_introspect_load_cache (GeglChantO *op_introspect)
+gegl_introspect_load_cache (GeglProperties *op_introspect)
{
GeglBuffer *new_buffer = NULL;
GeglNode *png_load = NULL;
@@ -47,7 +49,7 @@ gegl_introspect_load_cache (GeglChantO *op_introspect)
gchar *dot_filename = NULL;
gchar *dot_cmd = NULL;
- if (op_introspect->chant_data)
+ if (op_introspect->user_data)
return;
/* Construct temp filenames */
@@ -77,7 +79,7 @@ gegl_introspect_load_cache (GeglChantO *op_introspect)
gegl_node_link_many (png_load, buffer_sink, NULL);
gegl_node_process (buffer_sink);
- op_introspect->chant_data= new_buffer;
+ op_introspect->user_data= new_buffer;
/* Cleanup */
g_object_unref (buffer_sink);
@@ -91,27 +93,27 @@ gegl_introspect_load_cache (GeglChantO *op_introspect)
static void
gegl_introspect_dispose (GObject *object)
{
- GeglChantO *o = GEGL_CHANT_PROPERTIES (object);
+ GeglProperties *o = GEGL_PROPERTIES (object);
- if (o->chant_data != NULL)
+ if (o->user_data != NULL)
{
- g_object_unref (o->chant_data);
- o->chant_data = NULL;
+ g_object_unref (o->user_data);
+ o->user_data = NULL;
}
- G_OBJECT_CLASS (gegl_chant_parent_class)->dispose (object);
+ G_OBJECT_CLASS (gegl_op_parent_class)->dispose (object);
}
static GeglRectangle
gegl_introspect_get_bounding_box (GeglOperation *operation)
{
- GeglRectangle result = {0,0,0,0};
- GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+ GeglRectangle result = {0,0,0,0};
+ GeglProperties *o = GEGL_PROPERTIES (operation);
gint width, height;
gegl_introspect_load_cache (o);
- g_object_get (o->chant_data, "width", &width,
+ g_object_get (o->user_data, "width", &width,
"height", &height, NULL);
result.width = width;
@@ -127,22 +129,22 @@ gegl_introspect_process (GeglOperation *operation,
const GeglRectangle *result,
gint level)
{
- GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+ GeglProperties *o = GEGL_PROPERTIES (operation);
gegl_introspect_load_cache (o);
/* gegl_operation_context_take_object() takes the reference we have,
* so we must increase it since we want to keep the object
*/
- g_object_ref (o->chant_data);
+ g_object_ref (o->user_data);
- gegl_operation_context_take_object (context, output_pad, G_OBJECT (o->chant_data));
+ gegl_operation_context_take_object (context, output_pad, G_OBJECT (o->user_data));
return TRUE;
}
static void
-gegl_chant_class_init (GeglChantClass *klass)
+gegl_op_class_init (GeglOpClass *klass)
{
GObjectClass *object_class;
GeglOperationClass *operation_class;
diff --git a/operations/common/lens-distortion.c b/operations/common/lens-distortion.c
index 40833de..cde43a9 100644
--- a/operations/common/lens-distortion.c
+++ b/operations/common/lens-distortion.c
@@ -28,42 +28,49 @@
#include "config.h"
#include <glib/gi18n-lib.h>
-#ifdef GEGL_CHANT_PROPERTIES
-
-gegl_chant_double (main, _("Main"),
- -100.0, 100.0, 0.0,
- _("Amount of second-order distortion"))
-
-gegl_chant_double (edge, _("Edge"),
- -100.0, 100.0, 0.0,
- _("Amount of fourth-order distortion"))
-
-gegl_chant_double (zoom, _("Zoom"),
- -100.0, 100.0, 0.0,
- _("Rescale overall image size"))
-
-gegl_chant_double (x_shift, _("X shift"),
- -100.0, 100.0, 0.0,
- _("Effect centre offset in X"))
-
-gegl_chant_double (y_shift, _("Y shift"),
- -100.0, 100.0, 0.0,
- _("Effect centre offset in Y"))
-
-gegl_chant_double (brighten, _("Brighten"),
- -100.0, 100.0, 0.0,
- _("Adjust brightness in corners"))
-
-gegl_chant_color (background, _("Background"),
- "white",
- _("Background color"))
+#ifdef GEGL_PROPERTIES
+
+gegl_property_double (main, _("Main"),
+ "description", _("Amount of second-order distortion"),
+ "min", -100.0, "max", 100.0,
+ NULL)
+
+gegl_property_double (edge, _("Edge"),
+ "description", _("Amount of fourth-order distortion"),
+ "min", -100.0, "max", 100.0,
+ NULL)
+
+gegl_property_double (zoom, _("Zoom"),
+ "description", _("Rescale overall image size"),
+ "min", -100.0, "max", 100.0,
+ NULL)
+
+gegl_property_double (x_shift, _("X shift"),
+ "description", _("Effect centre offset in X"),
+ "min", -100.0, "max", 100.0,
+ NULL)
+
+gegl_property_double (y_shift, _("Y shift"),
+ "description", _("Effect centre offset in Y"),
+ "min", -100.0, "max", 100.0,
+ NULL)
+
+gegl_property_double (brighten, _("Brighten"),
+ "description", _("Adjust brightness in corners"),
+ "min", -100.0, "max", 100.0,
+ NULL)
+
+gegl_property_color (background, _("Background"),
+ "description", _("Background color"),
+ "default", "white",
+ NULL)
#else
-#define GEGL_CHANT_TYPE_FILTER
-#define GEGL_CHANT_C_FILE "lens-distortion.c"
+#define GEGL_OP_FILTER
+#define GEGL_OP_C_FILE "lens-distortion.c"
-#include "gegl-chant.h"
+#include "gegl-op.h"
#include <math.h>
#include <stdio.h>
@@ -103,8 +110,8 @@ reorder (gdouble *low,
}
static LensValues
-lens_setup_calc (GeglChantO *o,
- GeglRectangle boundary)
+lens_setup_calc (GeglProperties *o,
+ GeglRectangle boundary)
{
LensValues lens;
@@ -153,13 +160,13 @@ get_required (GeglRectangle *boundary,
GeglOperation *operation)
{
- GeglChantO *o;
- GeglRectangle area;
- LensValues lens;
- gdouble x1, y1, x2, y2, x3, y3, x4, y4, mag;
- gint x, y, width, height;
+ GeglProperties *o;
+ GeglRectangle area;
+ LensValues lens;
+ gdouble x1, y1, x2, y2, x3, y3, x4, y4, mag;
+ gint x, y, width, height;
- o = GEGL_CHANT_PROPERTIES (operation);
+ o = GEGL_PROPERTIES (operation);
lens = lens_setup_calc (o, *boundary);
@@ -408,12 +415,12 @@ process (GeglOperation *operation,
const GeglRectangle *result,
gint level)
{
- GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
- LensValues lens;
- GeglRectangle boundary;
- gint i, j;
- gfloat *src_buf, *dst_buf;
- gfloat background[4];
+ GeglProperties *o = GEGL_PROPERTIES (operation);
+ LensValues lens;
+ GeglRectangle boundary;
+ gint i, j;
+ gfloat *src_buf, *dst_buf;
+ gfloat background[4];
boundary = *gegl_operation_source_get_bounding_box (operation, "input");
lens = lens_setup_calc (o, boundary);
@@ -464,7 +471,7 @@ process (GeglOperation *operation,
}
static void
-gegl_chant_class_init (GeglChantClass *klass)
+gegl_op_class_init (GeglOpClass *klass)
{
GeglOperationClass *operation_class;
GeglOperationFilterClass *filter_class;
diff --git a/operations/common/levels.c b/operations/common/levels.c
index c3dd955..0e5ce22 100644
--- a/operations/common/levels.c
+++ b/operations/common/levels.c
@@ -21,23 +21,31 @@
#include <glib/gi18n-lib.h>
-#ifdef GEGL_CHANT_PROPERTIES
-
-gegl_chant_double_ui (in_low, _("Low input"), -1.0, 4.0, 0.0, 0.0, 1.0, 1.0,
- _("Input luminance level to become lowest output"))
-gegl_chant_double_ui (in_high, _("High input"), -1.0, 4.0, 1.0, 0.0, 1.0, 1.0,
- _("Input luminance level to become white."))
-gegl_chant_double_ui (out_low, _("Low output"), -1.0, 4.0, 0.0, 0.0, 1.0, 1.0,
- _("Lowest luminance level in output"))
-gegl_chant_double_ui (out_high, _("High output"), -1.0, 4.0, 1.0, 0.0, 1.0, 1.0,
- _("Highest luminance level in output"))
+#ifdef GEGL_PROPERTIES
+
+gegl_property_double (in_low, _("Low input"),
+ "description", _("Input luminance level to become lowest output"),
+ "min", -1.0, "max", 4.0, "default", 0.0, "ui-min", 0.0, "ui-max", 1.0,
+ NULL)
+gegl_property_double (in_high, _("High input"),
+ "description", _("Input luminance level to become white"),
+ "min", -1.0, "max", 4.0, "default", 1.0, "ui-min", 0.0, "ui-max", 1.0,
+ NULL)
+gegl_property_double (out_low, _("Low output"),
+ "description", _("Lowest luminance level in output"),
+ "min", -1.0, "max", 4.0, "default", 0.0, "ui-min", 0.0, "ui-max", 1.0,
+ NULL)
+gegl_property_double (out_high, _("High output"),
+ "description", _("Highest luminance level in output"),
+ "min", -1.0, "max", 4.0, "default", 1.0, "ui-min", 0.0, "ui-max", 1.0,
+ NULL)
#else
-#define GEGL_CHANT_TYPE_POINT_FILTER
-#define GEGL_CHANT_C_FILE "levels.c"
+#define GEGL_OP_POINT_FILTER
+#define GEGL_OP_C_FILE "levels.c"
-#include "gegl-chant.h"
+#include "gegl-op.h"
/* GeglOperationPointFilter gives us a linear buffer to operate on
* in our requested pixel format
@@ -50,7 +58,7 @@ process (GeglOperation *op,
const GeglRectangle *roi,
gint level)
{
- GeglChantO *o = GEGL_CHANT_PROPERTIES (op);
+ GeglProperties *o = GEGL_PROPERTIES (op);
gfloat *in_pixel;
gfloat *out_pixel;
gfloat in_range;
@@ -100,11 +108,11 @@ cl_process (GeglOperation *op,
const GeglRectangle *roi,
gint level)
{
- /* Retrieve a pointer to GeglChantO structure which contains all the
+ /* Retrieve a pointer to GeglProperties structure which contains all the
* chanted properties
*/
- GeglChantO *o = GEGL_CHANT_PROPERTIES (op);
+ GeglProperties *o = GEGL_PROPERTIES (op);
gfloat in_range;
gfloat out_range;
@@ -157,7 +165,7 @@ error:
static void
-gegl_chant_class_init (GeglChantClass *klass)
+gegl_op_class_init (GeglOpClass *klass)
{
GeglOperationClass *operation_class;
GeglOperationPointFilterClass *point_filter_class;
diff --git a/operations/common/linear-gradient.c b/operations/common/linear-gradient.c
index 97072dd..3987308 100644
--- a/operations/common/linear-gradient.c
+++ b/operations/common/linear-gradient.c
@@ -20,23 +20,48 @@
#include "config.h"
#include <glib/gi18n-lib.h>
-#ifdef GEGL_CHANT_PROPERTIES
-
-gegl_chant_double (start_x, _("X1"), G_MININT, G_MAXINT, 25.0, "")
-gegl_chant_double (start_y, _("Y1"), G_MININT, G_MAXINT, 25.0, "")
-gegl_chant_double (end_x, _("X2"), G_MININT, G_MAXINT, 150.0, "")
-gegl_chant_double (end_y, _("Y2"), G_MININT, G_MAXINT, 150.0, "")
-gegl_chant_color (start_color, _("Start Color"), "black",
- _("The color at (x1, y1)"))
-gegl_chant_color (end_color, _("End Color"), "white",
- _("The color at (x2, y2)"))
+#ifdef GEGL_PROPERTIES
+
+gegl_property_double (start_x, _("X1"),
+ "default", 25.0,
+ "unit", "pixel-coordinate",
+ "axis", "x",
+ NULL)
+gegl_property_double (start_y, _("Y1"),
+ "default", 25.0,
+ "unit", "pixel-coordinate",
+ "axis", "y",
+ NULL)
+
+gegl_property_double (end_x, _("X2"),
+ "default", 150.0,
+ "unit", "pixel-coordinate",
+ "axis", "x",
+ NULL)
+gegl_property_double (end_y, _("Y2"),
+ "default", 150.0,
+ "unit", "pixel-coordinate",
+ "axis", "y",
+ NULL)
+
+gegl_property_color (start_color, _("Start Color"),
+ "description", _("The color at (x1, y1)"),
+ "default", "black",
+ "role", "color-primary",
+ NULL)
+
+gegl_property_color (end_color, _("End Color"),
+ "description", _("The color at (x2, y2)"),
+ "default", "white",
+ "role", "color-secondary",
+ NULL)
#else
-#define GEGL_CHANT_TYPE_POINT_RENDER
-#define GEGL_CHANT_C_FILE "linear-gradient.c"
+#define GEGL_OP_POINT_RENDER
+#define GEGL_OP_C_FILE "linear-gradient.c"
-#include "gegl-chant.h"
+#include "gegl-op.h"
#include <math.h>
@@ -59,12 +84,9 @@ process (GeglOperation *operation,
const GeglRectangle *roi,
gint level)
{
- GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
- gfloat *out_pixel = out_buf;
- gfloat color1[4];
- gfloat color2[4];
- gfloat length;
- gfloat dx, dy;
+ GeglProperties *o = GEGL_PROPERTIES (operation);
+ gfloat *out_pixel = out_buf;
+ gfloat color1[4], color2[4], length, dx, dy;
dx = o->end_x - o->start_x;
dy = o->end_y - o->start_y;
@@ -108,7 +130,7 @@ process (GeglOperation *operation,
}
static void
-gegl_chant_class_init (GeglChantClass *klass)
+gegl_op_class_init (GeglOpClass *klass)
{
GeglOperationClass *operation_class;
GeglOperationPointRenderClass *point_render_class;
diff --git a/operations/common/load.c b/operations/common/load.c
index 1d1c360..f47a786 100644
--- a/operations/common/load.c
+++ b/operations/common/load.c
@@ -20,17 +20,19 @@
#include <glib/gi18n-lib.h>
-#ifdef GEGL_CHANT_PROPERTIES
+#ifdef GEGL_PROPERTIES
-gegl_chant_file_path (path, _("File"), "", _("Path of file to load."))
+gegl_property_file_path (path, _("File"),
+ "description", _("Path of file to load."),
+ NULL)
#else
-#define GEGL_CHANT_C_FILE "load.c"
+#define GEGL_OP_C_FILE "load.c"
#include "gegl-plugin.h"
-struct _GeglChant
+struct _GeglOp
{
GeglOperationMeta parent_instance;
gpointer properties;
@@ -42,9 +44,9 @@ struct _GeglChant
typedef struct
{
GeglOperationMetaClass parent_class;
-} GeglChantClass;
+} GeglOpClass;
-#include "gegl-chant.h"
+#include "gegl-op.h"
GEGL_DEFINE_DYNAMIC_OPERATION(GEGL_TYPE_OPERATION_META)
#include <stdio.h>
@@ -52,7 +54,7 @@ GEGL_DEFINE_DYNAMIC_OPERATION(GEGL_TYPE_OPERATION_META)
static void
do_setup (GeglOperation *operation, const gchar *new_path)
{
- GeglChant *self = GEGL_CHANT (operation);
+ GeglOp *self = GEGL_OP (operation);
if (!new_path || 0 == strlen (new_path))
{
@@ -96,8 +98,8 @@ do_setup (GeglOperation *operation, const gchar *new_path)
static void attach (GeglOperation *operation)
{
- GeglChant *self = GEGL_CHANT (operation);
- GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+ GeglOp *self = GEGL_OP (operation);
+ GeglProperties *o = GEGL_PROPERTIES (operation);
self->output = gegl_node_get_output_proxy (operation->node, "output");
@@ -117,7 +119,7 @@ detect (GeglOperation *operation,
gint x,
gint y)
{
- GeglChant *self = GEGL_CHANT (operation);
+ GeglOp *self = GEGL_OP (operation);
GeglNode *output = self->output;
GeglRectangle bounds;
@@ -142,9 +144,9 @@ my_set_property (GObject *gobject,
const GValue *value,
GParamSpec *pspec)
{
- GeglOperation *operation = GEGL_OPERATION (gobject);
- GeglChant *self = GEGL_CHANT (operation);
- GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+ GeglOperation *operation = GEGL_OPERATION (gobject);
+ GeglOp *self = GEGL_OP (operation);
+ GeglProperties *o = GEGL_PROPERTIES (operation);
const gchar *new_path = g_value_get_string (value);
@@ -159,7 +161,7 @@ my_set_property (GObject *gobject,
static void
prepare (GeglOperation *operation)
{
- GeglChant *self = GEGL_CHANT (operation);
+ GeglOp *self = GEGL_OP (operation);
GeglOperation *op;
/* forward the set BablFormat of the image loader on the meta-op itself,
@@ -171,7 +173,7 @@ prepare (GeglOperation *operation)
}
static void
-gegl_chant_class_init (GeglChantClass *klass)
+gegl_op_class_init (GeglOpClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GeglOperationClass *operation_class = GEGL_OPERATION_CLASS (klass);
diff --git a/operations/common/magick-load.c b/operations/common/magick-load.c
index 9664225..28293fa 100644
--- a/operations/common/magick-load.c
+++ b/operations/common/magick-load.c
@@ -21,22 +21,25 @@
#include <glib/gi18n-lib.h>
-#ifdef GEGL_CHANT_PROPERTIES
+#ifdef GEGL_PROPERTIES
-gegl_chant_file_path (path, _("File"), "/tmp/gegl-logo.svg", _("Path of file to load."))
+gegl_property_file_path (path, _("File"),
+ "description", _("Path of file to load."),
+ "default", "/tmp/gegl-logo.svg",
+ NULL)
#else
-#define GEGL_CHANT_TYPE_SOURCE
-#define GEGL_CHANT_C_FILE "magick-load.c"
+#define GEGL_OP_SOURCE
+#define GEGL_OP_C_FILE "magick-load.c"
-#include "gegl-chant.h"
+#include "gegl-op.h"
#include <stdio.h>
static void
-load_cache (GeglChantO *op_magick_load)
+load_cache (GeglProperties *op_magick_load)
{
- if (!op_magick_load->chant_data)
+ if (!op_magick_load->user_data)
{
gchar *filename;
gchar *cmd;
@@ -56,7 +59,7 @@ load_cache (GeglChantO *op_magick_load)
graph = gegl_graph (sink=gegl_node ("gegl:buffer-sink", "buffer", &newbuf, NULL,
gegl_node ("gegl:png-load", "path", filename, NULL)));
gegl_node_process (sink);
- op_magick_load->chant_data = (gpointer) newbuf;
+ op_magick_load->user_data = (gpointer) newbuf;
g_object_unref (graph);
g_free (cmd);
g_free (filename);
@@ -67,12 +70,12 @@ static GeglRectangle
get_bounding_box (GeglOperation *operation)
{
GeglRectangle result = {0,0,0,0};
- GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+ GeglProperties *o = GEGL_PROPERTIES (operation);
gint width, height;
load_cache (o);
- g_object_get (o->chant_data, "width", &width,
+ g_object_get (o->user_data, "width", &width,
"height", &height, NULL);
result.width = width;
result.height = height;
@@ -93,28 +96,28 @@ process (GeglOperation *operation,
const GeglRectangle *result,
gint level)
{
- GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+ GeglProperties *o = GEGL_PROPERTIES (operation);
- if (!o->chant_data)
+ if (!o->user_data)
return FALSE;
/* overriding the predefined behavior */
- g_object_ref (o->chant_data);
- gegl_operation_context_take_object (context, "output", G_OBJECT (o->chant_data));
+ g_object_ref (o->user_data);
+ gegl_operation_context_take_object (context, "output", G_OBJECT (o->user_data));
return TRUE;
}
static void finalize (GObject *object)
{
GeglOperation *op = (void*) object;
- GeglChantO *o = GEGL_CHANT_PROPERTIES (op);
- if (o->chant_data)
- g_object_unref (o->chant_data);
- o->chant_data = NULL;
- G_OBJECT_CLASS (gegl_chant_parent_class)->finalize (object);
+ GeglProperties *o = GEGL_PROPERTIES (op);
+ if (o->user_data)
+ g_object_unref (o->user_data);
+ o->user_data = NULL;
+ G_OBJECT_CLASS (gegl_op_parent_class)->finalize (object);
}
static void
-gegl_chant_class_init (GeglChantClass *klass)
+gegl_op_class_init (GeglOpClass *klass)
{
GeglOperationClass *operation_class;
GObjectClass *object_class;
diff --git a/operations/common/mantiuk06.c b/operations/common/mantiuk06.c
index f8a0bef..b6eab8c 100644
--- a/operations/common/mantiuk06.c
+++ b/operations/common/mantiuk06.c
@@ -26,25 +26,29 @@
#include <math.h>
-#ifdef GEGL_CHANT_PROPERTIES
+#ifdef GEGL_PROPERTIES
-gegl_chant_double (contrast, _("Contrast"),
- 0.0, 1.0, 0.1,
- _("The amount of contrast compression"))
-gegl_chant_double (saturation, _("Saturation"),
- 0.0, 2.0, 0.8,
- _("Global color saturation factor"))
-gegl_chant_double (detail, _("Detail"),
- 1.0, 99.0, 1.0,
- _("Level of emphasis on image gradient details"))
+gegl_property_double (contrast, _("Contrast"),
+ "description", _("The amount of contrast compression"),
+ "default", 0.1, "min", 0.0, "max", 1.0,
+ NULL)
+gegl_property_double (saturation, _("Saturation"),
+ "description", _("Global color saturation factor"),
+ "default", 0.8, "min", 0.0, "max", 2.0,
+ NULL)
+
+gegl_property_double (detail, _("Detail"),
+ "description", _("Level of emphasis on image gradient details"),
+ "default", 1.0, "min", 1.0, "max", 99.0,
+ NULL)
#else
-#define GEGL_CHANT_TYPE_FILTER
-#define GEGL_CHANT_C_FILE "mantiuk06.c"
+#define GEGL_OP_FILTER
+#define GEGL_OP_C_FILE "mantiuk06.c"
-#include "gegl-chant.h"
+#include "gegl-op.h"
#include <stdio.h>
#include <stdlib.h>
@@ -1581,10 +1585,9 @@ mantiuk06_process (GeglOperation *operation,
const GeglRectangle *result,
gint level)
{
- const GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
- const gint pix_stride = 4; /* RGBA */
- gfloat *lum,
- *pix;
+ const GeglProperties *o = GEGL_PROPERTIES (operation);
+ const gint pix_stride = 4; /* RGBA */
+ gfloat *lum, *pix;
g_return_val_if_fail (operation, FALSE);
g_return_val_if_fail (input, FALSE);
@@ -1618,7 +1621,7 @@ mantiuk06_process (GeglOperation *operation,
/*
*/
static void
-gegl_chant_class_init (GeglChantClass *klass)
+gegl_op_class_init (GeglOpClass *klass)
{
GeglOperationClass *operation_class;
GeglOperationFilterClass *filter_class;
diff --git a/operations/common/map-absolute.c b/operations/common/map-absolute.c
index d3866d6..d2db808 100644
--- a/operations/common/map-absolute.c
+++ b/operations/common/map-absolute.c
@@ -17,19 +17,20 @@
*
*/
-#ifdef GEGL_CHANT_PROPERTIES
+#ifdef GEGL_PROPERTIES
-gegl_chant_enum (sampler_type, _("Sampler"), GeglSamplerType, gegl_sampler_type,
- GEGL_SAMPLER_CUBIC, _("Sampler used internally"))
+gegl_property_enum (sampler_type, _("Resampling method"),
+ GeglSamplerType, gegl_sampler_type,
+ "default", GEGL_SAMPLER_CUBIC, NULL)
#else
-#define GEGL_CHANT_TYPE_COMPOSER
-#define GEGL_CHANT_C_FILE "map-absolute.c"
+#define GEGL_OP_COMPOSER
+#define GEGL_OP_C_FILE "map-absolute.c"
#include "config.h"
#include <glib/gi18n-lib.h>
-#include "gegl-chant.h"
+#include "gegl-op.h"
static void
@@ -60,7 +61,7 @@ process (GeglOperation *operation,
const GeglRectangle *result,
gint level)
{
- GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+ GeglProperties *o = GEGL_PROPERTIES (operation);
const Babl *format_io, *format_coords;
GeglSampler *sampler;
GeglBufferIterator *it;
@@ -130,7 +131,7 @@ process (GeglOperation *operation,
}
static void
-gegl_chant_class_init (GeglChantClass *klass)
+gegl_op_class_init (GeglOpClass *klass)
{
GeglOperationClass *operation_class;
GeglOperationComposerClass *composer_class;
diff --git a/operations/common/map-relative.c b/operations/common/map-relative.c
index 415becb..23db3ae 100644
--- a/operations/common/map-relative.c
+++ b/operations/common/map-relative.c
@@ -18,22 +18,26 @@
*/
-#ifdef GEGL_CHANT_PROPERTIES
-
-gegl_chant_double (scaling, _("Scaling"), 0.0, 5000.0, 1.0,
- _("scaling factor of displacement, indicates how large spatial"
- " displacement a relative mapping value of 1.0 corresponds to."))
-gegl_chant_enum (sampler_type, _("Sampler"), GeglSamplerType, gegl_sampler_type,
- GEGL_SAMPLER_CUBIC, _("Sampler used internally"))
+#ifdef GEGL_PROPERTIES
+
+gegl_property_double (scaling, _("Scaling"),
+ "description", _("scaling factor of displacement, indicates how large spatial"
+ " displacement a relative mapping value of 1.0 corresponds to."),
+ "min", 0.0, "max", 5000.0, "default", 1.0,
+ NULL)
+gegl_property_enum (sampler_type, _("Resampling method"),
+ GeglSamplerType, gegl_sampler_type,
+ "default", GEGL_SAMPLER_CUBIC,
+ NULL)
#else
-#define GEGL_CHANT_TYPE_COMPOSER
-#define GEGL_CHANT_C_FILE "map-relative.c"
+#define GEGL_OP_COMPOSER
+#define GEGL_OP_C_FILE "map-relative.c"
#include "config.h"
#include <glib/gi18n-lib.h>
-#include "gegl-chant.h"
+#include "gegl-op.h"
static void
@@ -64,7 +68,7 @@ process (GeglOperation *operation,
const GeglRectangle *result,
gint level)
{
- GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+ GeglProperties *o = GEGL_PROPERTIES (operation);
const Babl *format_io, *format_coords;
GeglSampler *sampler;
GeglBufferIterator *it;
@@ -89,7 +93,7 @@ process (GeglOperation *operation,
gint n_pixels = it->length;
gint x = it->roi->x; /* initial x */
gint y = it->roi->y; /* and y coordinates */
- gdouble scaling = GEGL_CHANT_PROPERTIES (operation)->scaling;
+ gdouble scaling = GEGL_PROPERTIES (operation)->scaling;
gfloat *in = it->data[index_in];
gfloat *out = it->data[index_out];
gfloat *coords = it->data[index_coords];
@@ -139,7 +143,7 @@ process (GeglOperation *operation,
}
static void
-gegl_chant_class_init (GeglChantClass *klass)
+gegl_op_class_init (GeglOpClass *klass)
{
GeglOperationClass *operation_class;
GeglOperationComposerClass *composer_class;
diff --git a/operations/common/matting-global.c b/operations/common/matting-global.c
index 332634f..e2ae589 100644
--- a/operations/common/matting-global.c
+++ b/operations/common/matting-global.c
@@ -20,17 +20,18 @@
#include <glib/gi18n-lib.h>
#include <math.h>
-#ifdef GEGL_CHANT_PROPERTIES
+#ifdef GEGL_PROPERTIES
-gegl_chant_int (iterations, _("Iterations"), 1, G_MAXINT, 10,
- _("Number of iterations"))
+gegl_property_int (iterations, _("Iterations"),
+ "description", _("Number of iterations"),
+ "default", 10, "ui-max", 200, "min", 1, NULL)
#else
-#define GEGL_CHANT_TYPE_COMPOSER
-#define GEGL_CHANT_C_FILE "matting-global.c"
+#define GEGL_OP_COMPOSER
+#define GEGL_OP_C_FILE "matting-global.c"
-#include "gegl-chant.h"
+#include "gegl-op.h"
#include "gegl-debug.h"
#define max(a,b) \
@@ -284,7 +285,7 @@ matting_process (GeglOperation *operation,
int level)
{
- const GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+ const GeglProperties *o = GEGL_PROPERTIES (operation);
gfloat *input = NULL;
guchar *trimap = NULL;
gfloat *output = NULL;
@@ -469,7 +470,7 @@ cleanup:
return success;
}
-static void gegl_chant_class_init (GeglChantClass *klass)
+static void gegl_op_class_init (GeglOpClass *klass)
{
GeglOperationClass *operation_class;
GeglOperationComposerClass *composer_class;
diff --git a/operations/common/mblur.c b/operations/common/mblur.c
index 2ac4b5c..ac25033 100644
--- a/operations/common/mblur.c
+++ b/operations/common/mblur.c
@@ -20,17 +20,19 @@
#include <glib/gi18n-lib.h>
-#ifdef GEGL_CHANT_PROPERTIES
+#ifdef GEGL_PROPERTIES
-gegl_chant_double (dampness, _("Dampness"), 0.0, 1.0, 0.95,
- _("The value represents the contribution of the past to the new frame."))
+gegl_property_double (dampness, _("Dampness"),
+ "description", _("The value represents the contribution of the past to the new frame."),
+ "min", 0.0, "max", 1.0, "default", 0.95,
+ NULL)
#else
-#define GEGL_CHANT_TYPE_FILTER
-#define GEGL_CHANT_C_FILE "mblur.c"
+#define GEGL_OP_FILTER
+#define GEGL_OP_C_FILE "mblur.c"
-#include "gegl-chant.h"
+#include "gegl-op.h"
typedef struct
{
@@ -39,15 +41,15 @@ typedef struct
static void
-init (GeglChantO *o)
+init (GeglProperties *o)
{
- Priv *priv = (Priv*)o->chant_data;
+ Priv *priv = (Priv*)o->user_data;
GeglRectangle extent = {0,0,1024,1024};
g_assert (priv == NULL);
priv = g_new0 (Priv, 1);
- o->chant_data = (void*) priv;
+ o->user_data = (void*) priv;
priv->acc = gegl_buffer_new (&extent, babl_format ("RGBA float"));
}
@@ -64,14 +66,14 @@ process (GeglOperation *operation,
const GeglRectangle *result,
gint level)
{
- GeglChantO *o;
- Priv *p;
+ GeglProperties *o;
+ Priv *p;
- o = GEGL_CHANT_PROPERTIES (operation);
- p = (Priv*)o->chant_data;
+ o = GEGL_PROPERTIES (operation);
+ p = (Priv*)o->user_data;
if (p == NULL)
init (o);
- p = (Priv*)o->chant_data;
+ p = (Priv*)o->user_data;
{
GeglBuffer *temp_in;
@@ -104,28 +106,27 @@ process (GeglOperation *operation,
return TRUE;
}
-
static void
finalize (GObject *object)
{
- GeglChantO *o = GEGL_CHANT_PROPERTIES (object);
+ GeglProperties *o = GEGL_PROPERTIES (object);
- if (o->chant_data)
+ if (o->user_data)
{
- Priv *p = (Priv*)o->chant_data;
+ Priv *p = (Priv*)o->user_data;
g_object_unref (p->acc);
- g_free (o->chant_data);
- o->chant_data = NULL;
+ g_free (o->user_data);
+ o->user_data = NULL;
}
- G_OBJECT_CLASS (gegl_chant_parent_class)->finalize (object);
+ G_OBJECT_CLASS (gegl_op_parent_class)->finalize (object);
}
static void
-gegl_chant_class_init (GeglChantClass *klass)
+gegl_op_class_init (GeglOpClass *klass)
{
GeglOperationClass *operation_class;
GeglOperationFilterClass *filter_class;
diff --git a/operations/common/mirrors.c b/operations/common/mirrors.c
index d73c24f..5113bce 100644
--- a/operations/common/mirrors.c
+++ b/operations/common/mirrors.c
@@ -25,41 +25,80 @@
#include <glib/gi18n-lib.h>
-#ifdef GEGL_CHANT_PROPERTIES
-
-gegl_chant_double (m_angle, _("Mirror rotation"), 0.0, 180.0, 0.0, _("Rotation applied to the mirrors"))
-
-gegl_chant_double (r_angle, _("Result rotation"), 0.0, 360.0, 0.0, _("Rotation applied to the result"))
-
-gegl_chant_int (n_segs, _("Mirrors"), 2, 24, 6, _("Number of mirrors to use"))
-
-gegl_chant_double (c_x, _("X offset"), 0.0, 1.0, 0.5, _("X offset of the result of mirroring"))
-
-gegl_chant_double (c_y, _("Y offset"), 0.0, 1.0, 0.5, _("Y offset of the result of mirroring"))
-
-gegl_chant_double (o_x, _("Center X"), -1.0, 1.0, 0.0, _("X axis ratio for the center of mirroring"))
-
-gegl_chant_double (o_y, _("Center Y"), -1.0, 1.0, 0.0, _("Y axis ratio for the center of mirroring"))
-
-gegl_chant_double (trim_x, _("Trim X"), 0.0, 0.5, 0.0, _("X axis ratio for trimming mirror expanse"))
-
-gegl_chant_double (trim_y, _("Trim Y"), 0.0, 0.5, 0.0, _("Y axis ratio for trimming mirror expanse"))
-
-gegl_chant_double (input_scale, _("Zoom"), 0.1, 100.0, 100.0, _("Scale factor to make rendering size
bigger"))
-
-gegl_chant_double (output_scale, _("Expand"), 0.0, 100.0, 1.0, _("Scale factor to make rendering size
bigger"))
-
-gegl_chant_boolean (clip, _("Clip result"), TRUE, _("Clip result to input size"))
-
-gegl_chant_boolean (warp, _("Wrap input"), TRUE, _("Fill full output area"))
+#ifdef GEGL_PROPERTIES
+
+gegl_property_double (m_angle, _("Mirror rotation"),
+ "description", _("Rotation applied to the mirrors"),
+ "default", 0.0, "min", 0.0, "max", 180.0,
+ "unit", "degree",
+ NULL)
+
+gegl_property_double (r_angle, _("Result rotation"),
+ "description", _("Rotation applied to the result"),
+ "min", 0.0, "max", 360.0, "default", 0.0,
+ "unit", "degree",
+ NULL)
+
+gegl_property_int (n_segs, _("Mirrors"),
+ "description", _("Number of mirrors to use"),
+ "default", 6, "min", 2, "max", 24,
+ NULL)
+
+gegl_property_double (c_x, _("X offset"),
+ "description", _("X offset of the result of mirroring"),
+ "default", 0.5, "min", 0.0, "max", 1.0,
+ NULL)
+
+gegl_property_double (c_y, _("Y offset"),
+ "description", _("Y offset of the result of mirroring"),
+ "default", 0.5, "min", 0.0, "max", 1.0,
+ NULL)
+
+gegl_property_double (o_x, _("Center X"),
+ "description", _("X axis ratio for the center of mirroring"),
+ "min", -1.0, "max", 1.0,
+ NULL)
+
+gegl_property_double (o_y, _("Center Y"),
+ "description", _("Y axis ratio for the center of mirroring"),
+ "min", -1.0, "max", 1.0,
+ NULL)
+
+gegl_property_double (trim_x, _("Trim X"),
+ "description", _("X axis ratio for trimming mirror expanse"),
+ "min", 0.0, "max", 0.5,
+ NULL)
+
+gegl_property_double (trim_y, _("Trim Y"),
+ "description", _("Y axis ratio for trimming mirror expanse"),
+ "min", 0.0, "max", 0.5,
+ NULL)
+
+gegl_property_double (input_scale, _("Zoom"),
+ "description", _("Scale factor to make rendering size bigger"),
+ "default", 100.0, "min", 0.1, "max", 100.0,
+ NULL)
+
+gegl_property_double (output_scale, _("Expand"),
+ "description", _("Scale factor to make rendering size bigger"),
+ "default", 1.0, "min", 0.0, "max", 100.0,
+ NULL)
+
+gegl_property_boolean (clip, _("Clip result"),
+ "description", _("Clip result to input size"),
+ "default", TRUE, NULL)
+
+gegl_property_boolean (warp, _("Wrap input"),
+ "description", _("Fill full output area"),
+ "default", TRUE, NULL)
#else
-#define GEGL_CHANT_TYPE_FILTER
-#define GEGL_CHANT_C_FILE "mirrors.c"
+#define GEGL_OP_FILTER
+#define GEGL_OP_C_FILE "mirrors.c"
-#include "gegl-chant.h"
+#include "gegl-op.h"
#include <math.h>
#if 0
@@ -267,7 +306,7 @@ get_effective_area (GeglOperation *operation)
{
GeglRectangle result = {0,0,0,0};
GeglRectangle *in_rect = gegl_operation_source_get_bounding_box (operation, "input");
- GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+ GeglProperties *o = GEGL_PROPERTIES (operation);
gdouble xt = o->trim_x * in_rect->width;
gdouble yt = o->trim_y * in_rect->height;
@@ -290,7 +329,7 @@ get_bounding_box (GeglOperation *operation)
{
GeglRectangle result = {0,0,0,0};
GeglRectangle *in_rect = gegl_operation_source_get_bounding_box (operation, "input");
- GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+ GeglProperties *o = GEGL_PROPERTIES (operation);
if (!in_rect){
return result;
@@ -350,10 +389,10 @@ process (GeglOperation *operation,
const GeglRectangle *result,
gint level)
{
- GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
- GeglRectangle boundary = gegl_operation_get_bounding_box (operation);
- GeglRectangle eff_boundary = get_effective_area (operation);
- const Babl *format = babl_format ("RaGaBaA float");
+ GeglProperties *o = GEGL_PROPERTIES (operation);
+ GeglRectangle boundary = gegl_operation_get_bounding_box (operation);
+ GeglRectangle eff_boundary = get_effective_area (operation);
+ const Babl *format = babl_format ("RaGaBaA float");
#ifdef DO_NOT_USE_BUFFER_SAMPLE
g_warning ("NOT USING BUFFER SAMPLE!");
@@ -379,7 +418,7 @@ process (GeglOperation *operation,
static void
-gegl_chant_class_init (GeglChantClass *klass)
+gegl_op_class_init (GeglOpClass *klass)
{
GeglOperationClass *operation_class;
GeglOperationFilterClass *filter_class;
diff --git a/operations/common/mono-mixer.c b/operations/common/mono-mixer.c
index a1129a3..1a4d6bb 100644
--- a/operations/common/mono-mixer.c
+++ b/operations/common/mono-mixer.c
@@ -21,26 +21,32 @@
#include <glib/gi18n-lib.h>
-#ifdef GEGL_CHANT_PROPERTIES
-
-gegl_chant_double_ui (red, _("Red"),
- -10.0, 10.0, 0.5, -1.0, 1.0, 1.0,
- _("Amount of red"))
-
-gegl_chant_double_ui (green, _("Green"),
- -10.0, 10.0, 0.25, -1.0, 1.0, 1.0,
- _("Amount of green"))
-
-gegl_chant_double_ui (blue, _("Blue"),
- -10.0, 10.0, 0.25, -1.0, 1.0, 1.0,
- _("Amount of blue"))
+#ifdef GEGL_PROPERTIES
+
+gegl_property_double (red, _("Red"),
+ "description", _("Amount of red"),
+ "default", 0.5, "min", -10.0, "max", 10.0,
+ "ui-min", -1.0, "ui-max", 1.0,
+ NULL)
+
+gegl_property_double (green, _("Green"),
+ "description", _("Amount of green"),
+ "default", 0.5, "min", -10.0, "max", 10.0,
+ "ui-min", -1.0, "ui-max", 1.0,
+ NULL)
+
+gegl_property_double (blue, _("Blue"),
+ "description", _("Amount of blue"),
+ "default", 0.5, "min", -10.0, "max", 10.0,
+ "ui-min", -1.0, "ui-max", 1.0,
+ NULL)
#else
-#define GEGL_CHANT_TYPE_POINT_FILTER
-#define GEGL_CHANT_C_FILE "mono-mixer.c"
+#define GEGL_OP_POINT_FILTER
+#define GEGL_OP_C_FILE "mono-mixer.c"
-#include "gegl-chant.h"
+#include "gegl-op.h"
static void
prepare (GeglOperation *operation)
@@ -57,7 +63,7 @@ process (GeglOperation *op,
const GeglRectangle *roi,
gint level)
{
- GeglChantO *o = GEGL_CHANT_PROPERTIES (op);
+ GeglProperties *o = GEGL_PROPERTIES (op);
gfloat red = o->red;
gfloat green = o->green;
gfloat blue = o->blue;
@@ -81,7 +87,7 @@ process (GeglOperation *op,
#include "opencl/mono-mixer.cl.h"
static void
-gegl_chant_class_init (GeglChantClass *klass)
+gegl_op_class_init (GeglOpClass *klass)
{
GeglOperationClass *operation_class;
GeglOperationPointFilterClass *point_filter_class;
diff --git a/operations/common/motion-blur-linear.c b/operations/common/motion-blur-linear.c
index 833a602..ff75645 100644
--- a/operations/common/motion-blur-linear.c
+++ b/operations/common/motion-blur-linear.c
@@ -21,28 +21,34 @@
#include <glib/gi18n-lib.h>
#include <math.h>
-#ifdef GEGL_CHANT_PROPERTIES
-
-gegl_chant_double_ui (length, _("Length"),
- 0.0, 1000.0, 10.0, 0.0, 300.0, 1.5,
- _("Length of blur in pixels"))
-
-gegl_chant_double_ui (angle, _("Angle"),
- -360, 360, 0, -180.0, 180.0, 1.0,
- _("Angle of blur in degrees"))
+#ifdef GEGL_PROPERTIES
+
+gegl_property_double (length, _("Length"),
+ "description", _("Length of blur in pixels"),
+ "default", 10.0, "min", 0.0, "max", 1000.0,
+ "ui-max", 300.0, "ui-gamma", 1.5,
+ "unit", "pixel-distance",
+ NULL)
+
+gegl_property_double (angle, _("Angle"),
+ "description", _("Angle of blur in degrees"),
+ "default", 0.0, "min", -360.0, "max", 360.0,
+ "ui-min", -180.0, "ui-max", 180.0,
+ "unit", "degrees",
+ NULL)
#else
-#define GEGL_CHANT_TYPE_AREA_FILTER
-#define GEGL_CHANT_C_FILE "motion-blur-linear.c"
+#define GEGL_OP_AREA_FILTER
+#define GEGL_OP_C_FILE "motion-blur-linear.c"
-#include "gegl-chant.h"
+#include "gegl-op.h"
static void
prepare (GeglOperation *operation)
{
GeglOperationAreaFilter *op_area = GEGL_OPERATION_AREA_FILTER (operation);
- GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+ GeglProperties *o = GEGL_PROPERTIES (operation);
gdouble theta = o->angle * G_PI / 180.0;
gdouble offset_x = fabs (o->length * cos (theta));
@@ -132,7 +138,7 @@ cl_process (GeglOperation *operation,
const GeglRectangle *src_rect)
{
GeglOperationAreaFilter *op_area = GEGL_OPERATION_AREA_FILTER (operation);
- GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+ GeglProperties *o = GEGL_PROPERTIES (operation);
const Babl *in_format = gegl_operation_get_format (operation, "input");
const Babl *out_format = gegl_operation_get_format (operation, "output");
@@ -201,7 +207,7 @@ process (GeglOperation *operation,
gint level)
{
GeglOperationAreaFilter *op_area = GEGL_OPERATION_AREA_FILTER (operation);
- GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
+ GeglProperties *o = GEGL_PROPERTIES (operation);
GeglRectangle src_rect;
gfloat *in_buf;
gfloat *out_buf;
@@ -286,7 +292,7 @@ process (GeglOperation *operation,
}
static void
-gegl_chant_class_init (GeglChantClass *klass)
+gegl_op_class_init (GeglOpClass *klass)
{
GeglOperationClass *operation_class;
GeglOperationFilterClass *filter_class;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]