gegl r2802 - in trunk: . operations/affine



Author: ok
Date: Mon Nov 24 01:21:46 2008
New Revision: 2802
URL: http://svn.gnome.org/viewvc/gegl?rev=2802&view=rev

Log:
* operations/affine/transform.c: (create_matrix): added an op
that makes an affine op from a string (like <g> in svg).
* operations/affine/module.c: (gegl_module_register): register
transform op.
* operations/affine/Makefile.am: added new op.


Added:
   trunk/operations/affine/transform.c
Modified:
   trunk/ChangeLog
   trunk/operations/affine/Makefile.am
   trunk/operations/affine/module.c

Modified: trunk/operations/affine/Makefile.am
==============================================================================
--- trunk/operations/affine/Makefile.am	(original)
+++ trunk/operations/affine/Makefile.am	Mon Nov 24 01:21:46 2008
@@ -15,6 +15,7 @@
 	rotate.c	\
 	scale.c		\
 	shear.c		\
+	transform.c	\
 	translate.c	\
 	chant.h
 

Modified: trunk/operations/affine/module.c
==============================================================================
--- trunk/operations/affine/module.c	(original)
+++ trunk/operations/affine/module.c	Mon Nov 24 01:21:46 2008
@@ -42,7 +42,8 @@
 GType scale_get_type     (void);
 GType shear_get_type     (void);
 GType translate_get_type (void);
-GType reflect_get_type   (void);
+GType reflect_get_type (void);
+GType transform_get_type   (void);
 
 G_MODULE_EXPORT gboolean
 gegl_module_register (GTypeModule *module)
@@ -56,6 +57,7 @@
   dummy = shear_get_type ();
   dummy = translate_get_type ();
   dummy = reflect_get_type ();
+  dummy = transform_get_type ();
 
   return TRUE;
 }

Added: trunk/operations/affine/transform.c
==============================================================================
--- (empty file)
+++ trunk/operations/affine/transform.c	Mon Nov 24 01:21:46 2008
@@ -0,0 +1,58 @@
+/* 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 2006 Philip Lafleur
+ */
+
+#include "config.h"
+#include <glib/gi18n-lib.h>
+
+
+#if GEGL_CHANT_PROPERTIES
+
+gegl_chant_string (transform, "", _("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 <math.h>
+
+static void
+create_matrix (GeglChantOperation *op,
+               Matrix3        matrix)
+{
+
+  gchar *p = strchr (op->transform, '(');
+  gfloat a;
+  gfloat b;
+  if (!p) return;
+  p++;
+  a = strtod(p, &p);
+  if (!p) return;
+  p = strchr (op->transform, ',');
+  if (!p) return;
+  p++;
+  b = strtod (p, &p);
+  if (!p) return;
+
+  matrix [0][2] = a;
+  matrix [1][2] = b;
+}
+
+#endif



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