[gegl/soc-2011-warp] add GeglInterpolation enum in the chant system, not totally working
- From: Michael Murà <mmure src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl/soc-2011-warp] add GeglInterpolation enum in the chant system, not totally working
- Date: Sun, 3 Jul 2011 09:52:04 +0000 (UTC)
commit 964a6dc7df5cc61d666c89ceec30c42c165da56f
Author: Michael Murà <batolettre gmail com>
Date: Sun Jul 3 03:10:44 2011 +0200
add GeglInterpolation enum in the chant system, not totally working
gegl/Makefile.am | 1 +
gegl/buffer/gegl-buffer.h | 7 -----
gegl/gegl-chant.h | 55 +++++++++++++++++++++++++++++++++-----------
gegl/gegl-types.c | 39 +++++++++++++++++++++++++++++++
gegl/gegl-types.h | 11 +++++++++
5 files changed, 92 insertions(+), 21 deletions(-)
---
diff --git a/gegl/Makefile.am b/gegl/Makefile.am
index 23ef3c9..e822c3a 100644
--- a/gegl/Makefile.am
+++ b/gegl/Makefile.am
@@ -68,6 +68,7 @@ GEGL_introspectable_sources = \
gegl-instrument.c \
gegl-utils.c \
gegl-lookup.c \
+ gegl-types.c \
gegl-xml.c \
gegl-matrix.c \
\
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..1dd1a24 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,15 @@ 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, \
+ GEGL_TYPE_INTERPOLATION,\
+ def, \
+ (GParamFlags) ( \
+ G_PARAM_READWRITE | \
+ G_PARAM_CONSTRUCT | \
+ GEGL_PARAM_PAD_INPUT)));
#include GEGL_CHANT_C_FILE
@@ -810,6 +836,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.c b/gegl/gegl-types.c
new file mode 100644
index 0000000..44b404b
--- /dev/null
+++ b/gegl/gegl-types.c
@@ -0,0 +1,39 @@
+/* This file is part of GEGL
+ *
+ * GEGL is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * GEGL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GEGL; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Copyright 2011 Michael Murà <batolettre gmail com>
+ */
+
+#include "config.h"
+#include <glib-object.h>
+#include "gegl-types.h"
+
+GType
+gegl_interpolation_get_type (void)
+{
+ static GType etype = 0;
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ { GEGL_INTERPOLATION_NEAREST, "GEGL_INTERPOLATION_NEAREST", "nearest" },
+ { GEGL_INTERPOLATION_LINEAR, "GEGL_INTERPOLATION_LINEAR", "linear" },
+ { GEGL_INTERPOLATION_CUBIC, "GEGL_INTERPOLATION_CUBIC", "cubic" },
+ { GEGL_INTERPOLATION_LANCZOS, "GEGL_INTERPOLATION_LANCZOS", "lanczos" },
+ { GEGL_INTERPOLATION_LOHALO, "GEGL_INTERPOLATION_LOHALO", "lohalo" },
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static ("GeglInterpolationType", values);
+ }
+ return etype;
+}
diff --git a/gegl/gegl-types.h b/gegl/gegl-types.h
index f42e6ca..b5de03b 100644
--- a/gegl/gegl-types.h
+++ b/gegl/gegl-types.h
@@ -64,6 +64,17 @@ 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;
+GType gegl_interpolation_get_type (void) G_GNUC_CONST;
+#define GEGL_TYPE_INTERPOLATION (gegl_interpolation_get_type())
+
+
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]