[gegl] transform: port from custom chant to gegl-op.h



commit b2abc86f033bb1dfe7dbb93aea2ecaccb5a214e0
Author: Øyvind Kolås <pippin gimp org>
Date:   Sat Mar 4 11:51:53 2017 +0100

    transform: port from custom chant to gegl-op.h

 operations/transform/module.c    |    4 +-
 operations/transform/transform.c |   45 +++++++++++++++++++++++++++++--------
 2 files changed, 37 insertions(+), 12 deletions(-)
---
diff --git a/operations/transform/module.c b/operations/transform/module.c
index 8a6bc2f..2bc55d8 100644
--- a/operations/transform/module.c
+++ b/operations/transform/module.c
@@ -47,7 +47,7 @@ GType gegl_op_scale_size_register_type            (GTypeModule *module);
 GType gegl_op_scale_size_keepaspect_register_type (GTypeModule *module);
 GType gegl_op_shear_register_type                 (GTypeModule *module);
 GType gegl_op_translate_register_type             (GTypeModule *module);
-GType transform_get_type   (void);
+GType gegl_op_transform_register_type             (GTypeModule *module);
 
 #include <stdio.h>
 
@@ -58,7 +58,6 @@ gegl_module_register (GTypeModule *module)
   transform_module = module;
 
   dummy = op_transform_get_type ();
-  dummy = transform_get_type ();
   dummy = gegl_op_scale_ratio_register_type (module);
   dummy = gegl_op_scale_size_register_type (module);
   dummy = gegl_op_scale_size_keepaspect_register_type (module);
@@ -66,6 +65,7 @@ gegl_module_register (GTypeModule *module)
   dummy = gegl_op_reflect_register_type (module);
   dummy = gegl_op_shear_register_type (module);
   dummy = gegl_op_translate_register_type (module);
+  dummy = gegl_op_transform_register_type (module);
   dummy = gegl_op_rotate_on_center_register_type (module);
 
   dummy ++; /* silence gcc, having it is required to avoid optimizing
diff --git a/operations/transform/transform.c b/operations/transform/transform.c
index 5ddf4e9..d822479 100644
--- a/operations/transform/transform.c
+++ b/operations/transform/transform.c
@@ -13,23 +13,29 @@
  * 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 2006 Philip Lafleur
+ * Copyright 2008, 2017 Øyvind Kolås
  */
 
 #include "config.h"
 #include <glib/gi18n-lib.h>
 
+#ifdef GEGL_PROPERTIES
 
-#ifdef GEGL_CHANT_PROPERTIES
-
-gegl_chant_string (transform, "", _("Transformation string"))
+property_string (transform, _("Y"), "")
+    description (_("Transformation SVG syntax transformation string"))
 
 #else
 
-#define GEGL_CHANT_NAME transform
-#define GEGL_CHANT_DESCRIPTION  _("Transforms the group (used by svg).")
-#define GEGL_CHANT_SELF "transform.c"
-#include "chant.h"
+#include "gegl-operation-filter.h"
+#include "transform-core.h"
+#define GEGL_OP_NO_SOURCE
+#define GEGL_OP_Parent  OpTransform
+#define GEGL_OP_PARENT  TYPE_OP_TRANSFORM
+#define GEGL_OP_NAME    transform
+#define GEGL_OP_BUNDLE
+#define GEGL_OP_C_FILE  "transform.c"
+
+#include "gegl-op.h"
 
 #include <math.h>
 
@@ -37,9 +43,28 @@ static void
 create_matrix (OpTransform *op,
                GeglMatrix3 *matrix)
 {
-  GeglChantOperation *chant = GEGL_CHANT_OPERATION (op);
+  GeglProperties *o = GEGL_PROPERTIES (op);
+  gegl_matrix3_parse_string (matrix, o->transform);
+}
+
+#include <stdio.h>
+
+static void
+gegl_op_class_init (GeglOpClass *klass)
+{
+  GeglOperationClass *operation_class;
+  OpTransformClass   *transform_class;
+
+  operation_class = GEGL_OPERATION_CLASS (klass);
+  transform_class = OP_TRANSFORM_CLASS (klass);
+  transform_class->create_matrix = create_matrix;
 
-  gegl_matrix3_parse_string (matrix, chant->transform);
+  gegl_operation_class_set_keys (operation_class,
+    "name", "gegl:transform",
+    "title", _("Transform"),
+    "categories", "transform",
+    "description", _("Do a transformation using SVG syntax transformation."),
+    NULL);
 }
 
 #endif


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]