[gegl] add GeglInterpolation enum in the chant system
- From: Ãyvind KolÃs <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] add GeglInterpolation enum in the chant system
- Date: Sun, 3 Jul 2011 01:58:40 +0000 (UTC)
commit 9abea8ed0d24074df83b77204b8a13a1fede0303
Author: Michael Murà <batolettre gmail com>
Date: Sun Jul 3 01:40:33 2011 +0200
add GeglInterpolation enum in the chant system
gegl/buffer/gegl-buffer.h | 7 -----
gegl/gegl-chant.h | 54 ++++++++++++++++++++++++++++----------
gegl/gegl-types.h | 7 +++++
operations/common/map-absolute.c | 4 ++-
4 files changed, 50 insertions(+), 22 deletions(-)
---
diff --git a/gegl/buffer/gegl-buffer.h b/gegl/buffer/gegl-buffer.h
index f303f52..f5f6d7b 100644
--- a/gegl/buffer/gegl-buffer.h
+++ b/gegl/buffer/gegl-buffer.h
@@ -307,13 +307,6 @@ void gegl_buffer_copy (GeglBuffer *src,
*/
GeglBuffer * gegl_buffer_dup (GeglBuffer *buffer);
-typedef enum {
- GEGL_INTERPOLATION_NEAREST = 0,
- GEGL_INTERPOLATION_LINEAR,
- GEGL_INTERPOLATION_CUBIC,
- GEGL_INTERPOLATION_LANCZOS,
- GEGL_INTERPOLATION_LOHALO
-} GeglInterpolation;
/**
* gegl_buffer_sample:
diff --git a/gegl/gegl-chant.h b/gegl/gegl-chant.h
index 24de227..f1cbb3c 100644
--- a/gegl/gegl-chant.h
+++ b/gegl/gegl-chant.h
@@ -341,18 +341,19 @@ struct _GeglChantO
* in finalize). Also serves as a filler making sure that we
* do not create an empty struct if there are no chanted properties.
*/
-#define gegl_chant_int(name, nick, min, max, def, blurb) gint name;
-#define gegl_chant_double(name, nick, min, max, def, blurb) gdouble name;
-#define gegl_chant_boolean(name, nick, def, blurb) gboolean name;
-#define gegl_chant_string(name, nick, def, blurb) gchar *name;
-#define gegl_chant_file_path(name, nick, def, blurb) gchar *name;
-#define gegl_chant_multiline(name, nick, def, blurb) gchar *name;
-#define gegl_chant_object(name,nick, blurb) GObject *name;
-#define gegl_chant_pointer(name, nick, blurb) gpointer name;
-#define gegl_chant_color(name, nick, def, blurb) GeglColor *name;
-#define gegl_chant_curve(name, nick, blurb) GeglCurve *name;
-#define gegl_chant_path(name, nick, blurb) GeglPath *name;\
- guint path_changed_handler;
+#define gegl_chant_int(name, nick, min, max, def, blurb) gint name;
+#define gegl_chant_double(name, nick, min, max, def, blurb) gdouble name;
+#define gegl_chant_boolean(name, nick, def, blurb) gboolean name;
+#define gegl_chant_string(name, nick, def, blurb) gchar *name;
+#define gegl_chant_file_path(name, nick, def, blurb) gchar *name;
+#define gegl_chant_multiline(name, nick, def, blurb) gchar *name;
+#define gegl_chant_object(name,nick, blurb) GObject *name;
+#define gegl_chant_pointer(name, nick, blurb) gpointer name;
+#define gegl_chant_color(name, nick, def, blurb) GeglColor *name;
+#define gegl_chant_curve(name, nick, blurb) GeglCurve *name;
+#define gegl_chant_path(name, nick, blurb) GeglPath *name;\
+ guint path_changed_handler;
+#define gegl_chant_interpolation(name, nick, def, blurb) GeglInterpolation name;
#include GEGL_CHANT_C_FILE
@@ -367,6 +368,7 @@ struct _GeglChantO
#undef gegl_chant_color
#undef gegl_chant_curve
#undef gegl_chant_path
+#undef gegl_chant_interpolation
};
#define GEGL_CHANT_OPERATION(obj) ((Operation*)(obj))
@@ -385,6 +387,7 @@ enum
#define gegl_chant_color(name, nick, def, blurb) PROP_##name,
#define gegl_chant_curve(name, nick, blurb) PROP_##name,
#define gegl_chant_path(name, nick, blurb) PROP_##name,
+#define gegl_chant_interpolation(name, nick, def, blurb) PROP_##name,
#include GEGL_CHANT_C_FILE
@@ -399,6 +402,7 @@ enum
#undef gegl_chant_color
#undef gegl_chant_curve
#undef gegl_chant_path
+#undef gegl_chant_interpolation
PROP_LAST
};
@@ -459,6 +463,10 @@ get_property (GObject *gobject,
if (!properties->name)properties->name = gegl_path_new (); /* this feels ugly */\
g_value_set_object (value, properties->name); \
break;/*XXX*/
+#define gegl_chant_interpolation(name, nick, def, blurb) \
+ case PROP_##name: \
+ g_value_set_enum (value, properties->name); \
+ break;
#include GEGL_CHANT_C_FILE
@@ -473,6 +481,7 @@ get_property (GObject *gobject,
#undef gegl_chant_color
#undef gegl_chant_curve
#undef gegl_chant_path
+#undef gegl_chant_interpolation
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, property_id, pspec);
break;
@@ -560,6 +569,10 @@ set_property (GObject *gobject,
G_CALLBACK(path_changed), gobject); \
}\
break; /*XXX*/
+#define gegl_chant_interpolation(name, nick, def, blurb) \
+ case PROP_##name: \
+ properties->name = g_value_get_enum (value); \
+ break;
#include GEGL_CHANT_C_FILE
@@ -574,6 +587,7 @@ set_property (GObject *gobject,
#undef gegl_chant_color
#undef gegl_chant_curve
#undef gegl_chant_path
+#undef gegl_chant_interpolation
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, property_id, pspec);
@@ -633,6 +647,7 @@ static void gegl_chant_destroy_notify (gpointer data)
g_object_unref (properties->name); \
properties->name = NULL; \
}
+#define gegl_chant_interpolation(name, nick, def, blurb)
#include GEGL_CHANT_C_FILE
@@ -647,6 +662,7 @@ static void gegl_chant_destroy_notify (gpointer data)
#undef gegl_chant_color
#undef gegl_chant_curve
#undef gegl_chant_path
+#undef gegl_chant_interpolation
g_slice_free (GeglChantO, properties);
}
@@ -678,6 +694,7 @@ gegl_chant_constructor (GType type,
{properties->name = gegl_color_new(def?def:"black");}
#define gegl_chant_path(name, nick, blurb)
#define gegl_chant_curve(name, nick, blurb)
+#define gegl_chant_interpolation(name, nick, def, blurb)
#include GEGL_CHANT_C_FILE
@@ -692,6 +709,7 @@ gegl_chant_constructor (GType type,
#undef gegl_chant_color
#undef gegl_chant_curve
#undef gegl_chant_path
+#undef gegl_chant_interpolation
g_object_set_data_full (obj, "chant-data", obj, gegl_chant_destroy_notify);
properties ++; /* evil hack to silence gcc */
@@ -777,7 +795,7 @@ gegl_chant_class_intern_init (gpointer klass)
def, \
(GParamFlags) ( \
G_PARAM_READWRITE |\
- G_PARAM_CONSTRUCT | \
+ G_PARAM_CONSTRUCT | \
GEGL_PARAM_PAD_INPUT)));
#define gegl_chant_path(name, nick, blurb) \
g_object_class_install_property (object_class, PROP_##name, \
@@ -795,7 +813,14 @@ gegl_chant_class_intern_init (gpointer klass)
G_PARAM_READWRITE |\
G_PARAM_CONSTRUCT |\
GEGL_PARAM_PAD_INPUT)));
-
+#define gegl_chant_interpolation(name, nick, def, blurb) \
+ g_object_class_install_property (object_class, PROP_##name, \
+ g_param_spec_enum (#name, nick, blurb, \
+ GeglInterpolation, \
+ def, \
+ G_PARAM_READWRITE | \
+ G_PARAM_CONSTRUCT | \
+ GEGL_PARAM_PAD_INPUT));
#include GEGL_CHANT_C_FILE
@@ -810,6 +835,7 @@ gegl_chant_class_intern_init (gpointer klass)
#undef gegl_chant_color
#undef gegl_chant_curve
#undef gegl_chant_path
+#undef gegl_chant_interpolation
}
diff --git a/gegl/gegl-types.h b/gegl/gegl-types.h
index f42e6ca..9004da8 100644
--- a/gegl/gegl-types.h
+++ b/gegl/gegl-types.h
@@ -64,6 +64,13 @@ GType gegl_processor_get_type (void) G_GNUC_CONST;
#define GEGL_PROCESSOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEGL_TYPE_PROCESSOR, GeglProcessor))
#define GEGL_IS_PROCESSOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEGL_TYPE_PROCESSOR))
+typedef enum {
+ GEGL_INTERPOLATION_NEAREST = 0,
+ GEGL_INTERPOLATION_LINEAR,
+ GEGL_INTERPOLATION_CUBIC,
+ GEGL_INTERPOLATION_LANCZOS,
+ GEGL_INTERPOLATION_LOHALO
+} GeglInterpolation;
G_END_DECLS
diff --git a/operations/common/map-absolute.c b/operations/common/map-absolute.c
index d913035..8f6898c 100644
--- a/operations/common/map-absolute.c
+++ b/operations/common/map-absolute.c
@@ -26,10 +26,12 @@
#include "buffer/gegl-sampler.h"
#include "buffer/gegl-buffer-iterator.h"
-#include <stdio.h>
#ifdef GEGL_CHANT_PROPERTIES
+gegl_chant_interpolation (interp, _("Interpolation"),
+ GEGL_INTERPOLATION_CUBIC, _("Interpolation used internaly"))
+
#else
#define GEGL_CHANT_TYPE_COMPOSER
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]