[gimp/soc-2011-warp] add boilerplate for a GimpWarp Gegl operator
- From: Michael Muré <mmure src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/soc-2011-warp] add boilerplate for a GimpWarp Gegl operator
- Date: Sat, 4 Jun 2011 00:22:22 +0000 (UTC)
commit 298c57e7d0302efc0482fe6bcb7a9068a6ebc2e1
Author: Michael Muré <batolettre gmail com>
Date: Sat Jun 4 02:21:39 2011 +0200
add boilerplate for a GimpWarp Gegl operator
app/gegl/Makefile.am | 2 +
app/gegl/gimp-gegl-types.h | 1 +
app/gegl/gimpoperationwarp.c | 154 ++++++++++++++++++++++++++++++++++++++++++
app/gegl/gimpoperationwarp.h | 52 ++++++++++++++
app/gegl/makefile.msc | 1 +
5 files changed, 210 insertions(+), 0 deletions(-)
---
diff --git a/app/gegl/Makefile.am b/app/gegl/Makefile.am
index addc33f..3442165 100644
--- a/app/gegl/Makefile.am
+++ b/app/gegl/Makefile.am
@@ -73,6 +73,8 @@ libappgegl_a_sources = \
gimpoperationposterize.h \
gimpoperationthreshold.c \
gimpoperationthreshold.h \
+ gimpoperationwarp.c \
+ gimpoperationwarp.h \
\
gimpoperationpointlayermode.c \
gimpoperationpointlayermode.h \
diff --git a/app/gegl/gimp-gegl-types.h b/app/gegl/gimp-gegl-types.h
index af17404..8d307fc 100644
--- a/app/gegl/gimp-gegl-types.h
+++ b/app/gegl/gimp-gegl-types.h
@@ -41,6 +41,7 @@ typedef struct _GimpOperationHueSaturation GimpOperationHueSaturation;
typedef struct _GimpOperationLevels GimpOperationLevels;
typedef struct _GimpOperationPosterize GimpOperationPosterize;
typedef struct _GimpOperationThreshold GimpOperationThreshold;
+typedef struct _GimpOperationWarp GimpOperationWarp;
typedef struct _GimpOperationPointLayerMode GimpOperationPointLayerMode;
typedef struct _GimpOperationDissolveMode GimpOperationDissolveMode;
diff --git a/app/gegl/gimpoperationwarp.c b/app/gegl/gimpoperationwarp.c
new file mode 100644
index 0000000..0fed2d3
--- /dev/null
+++ b/app/gegl/gimpoperationwarp.c
@@ -0,0 +1,154 @@
+/* GIMP - The GNU Image Manipulation Program
+ *
+ * gimpoperationwarp.c
+ * Copyright (C) 2011 Michael Muré <batolettre gmail com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <gegl.h>
+#include <gegl-buffer-iterator.h>
+
+#include "libgimpmath/gimpmath.h"
+
+#include "gimp-gegl-types.h"
+
+#include "gimpoperationwarp.h"
+
+
+enum
+{
+ PROP_0
+};
+
+
+static void gimp_operation_warp_finalize (GObject *object);
+static void gimp_operation_warp_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void gimp_operation_warp_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void gimp_operation_warp_prepare (GeglOperation *operation);
+static gboolean gimp_operation_warp_process (GeglOperation *operation,
+ GeglBuffer *in_buf,
+ GeglBuffer *out_buf,
+ const GeglRectangle *roi);
+GeglRectangle gimp_operation_warp_get_bounding_box (GeglOperation *operation);
+
+
+G_DEFINE_TYPE (GimpOperationWarp, gimp_operation_warp,
+ GEGL_TYPE_OPERATION_FILTER)
+
+#define parent_class gimp_operation_warp_parent_class
+
+
+static void
+gimp_operation_warp_class_init (GimpOperationWarpClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GeglOperationClass *operation_class = GEGL_OPERATION_CLASS (klass);
+ GeglOperationFilterClass *filter_class = GEGL_OPERATION_FILTER_CLASS (klass);
+
+ object_class->get_property = gimp_operation_warp_get_property;
+ object_class->set_property = gimp_operation_warp_set_property;
+ object_class->finalize = gimp_operation_warp_finalize;
+
+ operation_class->name = "gimp:warp";
+ operation_class->categories = "transform";
+ operation_class->description = "GIMP warp";
+
+ operation_class->prepare = gimp_operation_warp_prepare;
+ operation_class->get_bounding_box = gimp_operation_warp_get_bounding_box;
+
+ filter_class->process = gimp_operation_warp_process;
+}
+
+static void
+gimp_operation_warp_init (GimpOperationWarp *self)
+{
+}
+
+static void
+gimp_operation_warp_finalize (GObject *object)
+{
+ GimpOperationWarp *self = GIMP_OPERATION_WARP (object);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+gimp_operation_warp_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GimpOperationWarp *self = GIMP_OPERATION_WARP (object);
+
+ switch (property_id)
+ {
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gimp_operation_warp_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GimpOperationWarp *self = GIMP_OPERATION_WARP (object);
+
+ switch (property_id)
+ {
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gimp_operation_warp_prepare (GeglOperation *operation)
+{
+ gegl_operation_set_format (operation, "input", babl_format ("RGBA float"));
+ gegl_operation_set_format (operation, "output", babl_format ("RGBA float"));
+}
+
+static gboolean
+gimp_operation_warp_process (GeglOperation *operation,
+ GeglBuffer *in_buf,
+ GeglBuffer *out_buf,
+ const GeglRectangle *roi)
+{
+ GimpOperationWarp *ow = GIMP_OPERATION_WARP (operation);
+
+ return TRUE;
+}
+
+GeglRectangle
+gimp_operation_warp_get_bounding_box (GeglOperation *operation)
+{
+ GeglRectangle result = *gegl_operation_source_get_bounding_box (operation,
+ "input");
+
+ return result;
+}
diff --git a/app/gegl/gimpoperationwarp.h b/app/gegl/gimpoperationwarp.h
new file mode 100644
index 0000000..e48f066
--- /dev/null
+++ b/app/gegl/gimpoperationwarp.h
@@ -0,0 +1,52 @@
+/* GIMP - The GNU Image Manipulation Program
+ *
+ * gimpoperationwarp.h
+ * Copyright (C) 2011 Michael Muré <batolettre gmail com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GIMP_OPERATION_WARP_H__
+#define __GIMP_OPERATION_WARP_H__
+
+
+#include <gegl-plugin.h>
+#include <operation/gegl-operation-filter.h>
+
+
+#define GIMP_TYPE_OPERATION_WARP (gimp_operation_warp_get_type ())
+#define GIMP_OPERATION_WARP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_OPERATION_WARP, GimpOperationWarp))
+#define GIMP_OPERATION_WARP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_OPERATION_WARP, GimpOperationWarpClass))
+#define GIMP_IS_OPERATION_WARP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_OPERATION_WARP))
+#define GIMP_IS_OPERATION_WARP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_OPERATION_WARP))
+#define GIMP_OPERATION_WARP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_OPERATION_WARP, GimpOperationWarpClass))
+
+
+typedef struct _GimpOperationWarpClass GimpOperationWarpClass;
+
+struct _GimpOperationWarp
+{
+ GeglOperationFilter parent_instance;
+};
+
+struct _GimpOperationWarpClass
+{
+ GeglOperationFilterClass parent_class;
+};
+
+
+GType gimp_operation_warp_get_type (void) G_GNUC_CONST;
+
+
+#endif /* __GIMP_OPERATION_WARP_H__ */
diff --git a/app/gegl/makefile.msc b/app/gegl/makefile.msc
index b616f94..2e63acb 100644
--- a/app/gegl/makefile.msc
+++ b/app/gegl/makefile.msc
@@ -46,6 +46,7 @@ OBJECTS = \
gimpoperationpointfilter.obj \
gimpposterizeconfig.obj \
gimpthresholdconfig.obj \
+ gimpoperationwarp.obj \
INCLUDES = \
-FImsvc_recommended_pragmas.h \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]