gegl r2811 - in trunk: . gegl operations/affine



Author: ok
Date: Fri Nov 28 00:11:09 2008
New Revision: 2811
URL: http://svn.gnome.org/viewvc/gegl?rev=2811&view=rev

Log:
* operations/affine/matrix.c:
* operations/affine/matrix.h: moved these,..
* operations/affine/Makefile.am: ..
* gegl/Makefile.am: .. here, and made it be GeglMatrix3 instead of
just Matrix3.
* gegl/gegl-matrix.c:
* gegl/gegl-matrix.h:
* gegl/gegl-plugin.h:
Fixed up affine op to use the new code.
* operations/affine/affine.c: (op_affine_init),
(get_source_matrix), (get_bounding_box), (detect),
(get_required_for_output), (get_invalidated_by_change),
(affine_generic), (process):
* operations/affine/affine.h:
* operations/affine/chant.h:
* operations/affine/reflect.c: (create_matrix):
* operations/affine/rotate.c: (create_matrix):
* operations/affine/scale.c: (create_matrix):
* operations/affine/shear.c: (create_matrix):
* operations/affine/transform.c: (create_matrix):
* operations/affine/translate.c: (create_matrix):


Added:
   trunk/gegl/gegl-matrix.c   (contents, props changed)
      - copied, changed from r2800, /trunk/operations/affine/matrix.c
   trunk/gegl/gegl-matrix.h   (contents, props changed)
      - copied, changed from r2800, /trunk/operations/affine/matrix.h
Removed:
   trunk/operations/affine/matrix.c
   trunk/operations/affine/matrix.h
Modified:
   trunk/ChangeLog
   trunk/gegl/Makefile.am
   trunk/gegl/gegl-plugin.h
   trunk/operations/affine/Makefile.am
   trunk/operations/affine/affine.c
   trunk/operations/affine/affine.h
   trunk/operations/affine/chant.h
   trunk/operations/affine/reflect.c
   trunk/operations/affine/rotate.c
   trunk/operations/affine/scale.c
   trunk/operations/affine/shear.c
   trunk/operations/affine/transform.c
   trunk/operations/affine/translate.c

Modified: trunk/gegl/Makefile.am
==============================================================================
--- trunk/gegl/Makefile.am	(original)
+++ trunk/gegl/Makefile.am	Fri Nov 28 00:11:09 2008
@@ -20,6 +20,7 @@
 	gegl-init.c			\
 	gegl-instrument.c		\
 	gegl-utils.c			\
+	gegl-matrix.c			\
 	gegl-xml.c			\
 	\
 	gegl-chant.h			\
@@ -30,6 +31,7 @@
 	gegl-init.h			\
 	gegl-instrument.h		\
 	gegl-module.h			\
+	gegl-matrix.h			\
 	gegl-plugin.h			\
 	gegl-types.h			\
 	gegl-xml.h
@@ -64,6 +66,7 @@
 libgegl_ GEGL_API_VERSION@include_HEADERS =	\
     gegl.h				\
     gegl-utils.h			\
+    gegl-matrix.h			\
     gegl-chant.h			\
     gegl-simd.h				\
     gegl-plugin.h			\

Copied: trunk/gegl/gegl-matrix.c (from r2800, /trunk/operations/affine/matrix.c)
==============================================================================
--- /trunk/operations/affine/matrix.c	(original)
+++ trunk/gegl/gegl-matrix.c	Fri Nov 28 00:11:09 2008
@@ -18,11 +18,12 @@
 
 #include <math.h>
 #include <string.h>
+#include <stdlib.h>
 
-#include "matrix.h"
+#include "gegl-matrix.h"
 
 void
-matrix3_identity (Matrix3 matrix)
+gegl_matrix3_identity (GeglMatrix3 matrix)
 {
   matrix [0][0] = matrix [1][1] = matrix [2][2] = 1.;
 
@@ -32,8 +33,8 @@
 }
 
 gboolean
-matrix3_equal (Matrix3 matrix1,
-               Matrix3 matrix2)
+gegl_matrix3_equal (GeglMatrix3 matrix1,
+                    GeglMatrix3 matrix2)
 {
   gint x, y;
 
@@ -45,38 +46,38 @@
 }
 
 gboolean
-matrix3_is_identity (Matrix3 matrix)
+gegl_matrix3_is_identity (GeglMatrix3 matrix)
 {
-  Matrix3 identity;
+  GeglMatrix3 identity;
 
-  matrix3_identity (identity);
-  return matrix3_equal (identity, matrix);
+  gegl_matrix3_identity (identity);
+  return gegl_matrix3_equal (identity, matrix);
 }
 
 gboolean
-matrix3_is_scale (Matrix3 matrix)
+gegl_matrix3_is_scale (GeglMatrix3 matrix)
 {
-  Matrix3 copy;
+  GeglMatrix3 copy;
 
-  matrix3_copy (copy, matrix);
+  gegl_matrix3_copy (copy, matrix);
   copy [0][0] = copy [1][1] = 1.;
   copy [0][2] = copy [1][2] = 0.;
-  return matrix3_is_identity (copy);
+  return gegl_matrix3_is_identity (copy);
 }
 
 gboolean
-matrix3_is_translate (Matrix3 matrix)
+gegl_matrix3_is_translate (GeglMatrix3 matrix)
 {
-  Matrix3 copy;
+  GeglMatrix3 copy;
 
-  matrix3_copy (copy, matrix);
+  gegl_matrix3_copy (copy, matrix);
   copy [0][2] = copy [1][2] = 0.;
-  return matrix3_is_identity (copy);
+  return gegl_matrix3_is_identity (copy);
 }
 
 void
-matrix3_copy (Matrix3 dst,
-              Matrix3 src)
+gegl_matrix3_copy (GeglMatrix3 dst,
+                   GeglMatrix3 src)
 {
   memcpy (dst [0], src [0], 3 * sizeof (gdouble));
   memcpy (dst [1], src [1], 3 * sizeof (gdouble));
@@ -84,7 +85,7 @@
 }
 
 gdouble
-matrix3_determinant (Matrix3 matrix)
+gegl_matrix3_determinant (GeglMatrix3 matrix)
 {
   gdouble determinant;
 
@@ -98,13 +99,13 @@
 }
 
 void
-matrix3_invert (Matrix3 matrix)
+gegl_matrix3_invert (GeglMatrix3 matrix)
 {
-  Matrix3 copy;
+  GeglMatrix3 copy;
   gdouble coeff;
 
-  matrix3_copy (copy, matrix);
-  coeff = 1 / matrix3_determinant (matrix);
+  gegl_matrix3_copy (copy, matrix);
+  coeff = 1 / gegl_matrix3_determinant (matrix);
 
   matrix [0][0] = (copy [1][1] * copy [2][2] -
                    copy [1][2] * copy [2][1]) * coeff;
@@ -129,11 +130,11 @@
 }
 
 void
-matrix3_multiply (Matrix3 left,
-                  Matrix3 right,
-                  Matrix3 product)
+gegl_matrix3_multiply (GeglMatrix3 left,
+                       GeglMatrix3 right,
+                       GeglMatrix3 product)
 {
-  Matrix3 temp;
+  GeglMatrix3 temp;
   gint    i;
 
   for (i = 0; i < 3; i++)
@@ -146,11 +147,11 @@
                     + left [i][2] * right [2][2];
     }
 
-  matrix3_copy (product, temp);
+  gegl_matrix3_copy (product, temp);
 }
 
 void
-matrix3_originate (Matrix3 matrix,
+gegl_matrix3_originate (GeglMatrix3 matrix,
                    gdouble x,
                    gdouble y)
 {
@@ -164,9 +165,9 @@
 }
 
 void
-matrix3_transform_point (Matrix3  matrix,
-                         gdouble *x,
-                         gdouble *y)
+gegl_matrix3_transform_point (GeglMatrix3  matrix,
+                              gdouble     *x,
+                              gdouble     *y)
 {
   gdouble xp,
           yp;
@@ -178,3 +179,50 @@
   *x = xp;
   *y = yp;
 }
+
+void
+gegl_matrix3_parse_string (GeglMatrix3  matrix,
+                           const gchar *string)
+{
+  if (strstr (string, "translate"))
+    {
+      gchar *p = strchr (string, '(');
+      gfloat a;
+      gfloat b;
+      if (!p) return;
+      p++;
+      a = strtod(p, &p);
+      if (!p) return;
+      p = strchr (string, ',');
+      if (!p) return;
+      p++;
+      b = strtod (p, &p);
+      if (!p) return;
+
+      matrix [0][2] = a;
+      matrix [1][2] = b;
+    }
+  else if (strstr (string, "matrix"))
+    {
+      gchar *p = strchr (string, '(');
+      gfloat a;
+      gint i,j;
+      if (!p) return;
+      p++;
+
+      /* last row should always be this for affine transforms */
+      matrix[0][2] = matrix[1][2] = 0;
+      matrix[2][2] = 1;
+
+      for (i=0;i<3;i++)
+        for (j=0;j<2;j++)
+          {
+            a = strtod(p, &p);
+            matrix [i][j] = a;
+            if (!p) return;
+            p = strchr (string, ',');
+            if (!p) return;
+            p++;
+          }
+    }
+}

Copied: trunk/gegl/gegl-matrix.h (from r2800, /trunk/operations/affine/matrix.h)
==============================================================================
--- /trunk/operations/affine/matrix.h	(original)
+++ trunk/gegl/gegl-matrix.h	Fri Nov 28 00:11:09 2008
@@ -1,28 +1,30 @@
-#ifndef __AFFINE_MATRIX_H__
-#define __AFFINE_MATRIX_H__
+#ifndef __GEGL_MATRIX_H__
+#define __GEGL_MATRIX_H__
 
 #include <glib.h>
 
-typedef gdouble Matrix3 [3][3];
+typedef gdouble GeglMatrix3 [3][3];
 
-void       matrix3_identity        (Matrix3 matrix);
-gboolean   matrix3_equal           (Matrix3 matrix1,
-                                    Matrix3 matrix2);
-gboolean   matrix3_is_identity     (Matrix3 matrix);
-gboolean   matrix3_is_scale        (Matrix3 matrix);
-gboolean   matrix3_is_translate    (Matrix3 matrix);
-void       matrix3_copy            (Matrix3 dst,
-                                    Matrix3 src);
-gdouble    matrix3_determinant     (Matrix3 matrix);
-void       matrix3_invert          (Matrix3 matrix);
-void       matrix3_multiply        (Matrix3 left,
-                                    Matrix3 right,
-                                    Matrix3 product);
-void       matrix3_originate       (Matrix3 matrix,
-                                    gdouble x,
-                                    gdouble y);
-void       matrix3_transform_point (Matrix3   matrix,
-                                    gdouble *x,
-                                    gdouble *y);
+void       gegl_matrix3_identity        (GeglMatrix3 matrix);
+gboolean   gegl_matrix3_equal           (GeglMatrix3 matrix1,
+                                         GeglMatrix3 matrix2);
+gboolean   gegl_matrix3_is_identity     (GeglMatrix3 matrix);
+gboolean   gegl_matrix3_is_scale        (GeglMatrix3 matrix);
+gboolean   gegl_matrix3_is_translate    (GeglMatrix3 matrix);
+void       gegl_matrix3_copy            (GeglMatrix3 dst,
+                                         GeglMatrix3 src);
+gdouble    gegl_matrix3_determinant     (GeglMatrix3 matrix);
+void       gegl_matrix3_invert          (GeglMatrix3 matrix);
+void       gegl_matrix3_multiply        (GeglMatrix3 left,
+                                         GeglMatrix3 right,
+                                         GeglMatrix3 product);
+void       gegl_matrix3_originate       (GeglMatrix3 matrix,
+                                         gdouble x,
+                                         gdouble y);
+void       gegl_matrix3_transform_point (GeglMatrix3   matrix,
+                                         gdouble *x,
+                                         gdouble *y);
+void       gegl_matrix3_parse_string    (GeglMatrix3 matrix,
+                                         const gchar *string);
 
 #endif

Modified: trunk/gegl/gegl-plugin.h
==============================================================================
--- trunk/gegl/gegl-plugin.h	(original)
+++ trunk/gegl/gegl-plugin.h	Fri Nov 28 00:11:09 2008
@@ -34,6 +34,7 @@
 typedef struct _GeglPad              GeglPad;
 typedef struct _GeglConnection       GeglConnection;
 
+#include <gegl-matrix.h>
 #include <gegl-utils.h>
 #include <gegl-buffer.h>
 #include <gegl-paramspecs.h>

Modified: trunk/operations/affine/Makefile.am
==============================================================================
--- trunk/operations/affine/Makefile.am	(original)
+++ trunk/operations/affine/Makefile.am	Fri Nov 28 00:11:09 2008
@@ -7,8 +7,6 @@
 affine_la_SOURCES = \
 	affine.c	\
 	affine.h	\
-	matrix.c	\
-	matrix.h	\
 	module.c	\
 	module.h	\
 	reflect.c	\

Modified: trunk/operations/affine/affine.c
==============================================================================
--- trunk/operations/affine/affine.c	(original)
+++ trunk/operations/affine/affine.c	Fri Nov 28 00:11:09 2008
@@ -37,7 +37,6 @@
 
 #include "affine.h"
 #include "module.h"
-#include "matrix.h"
 
 enum
 {
@@ -64,7 +63,7 @@
 static gboolean      is_intermediate_node    (OpAffine            *affine);
 static gboolean      is_composite_node       (OpAffine            *affine);
 static void          get_source_matrix       (OpAffine            *affine,
-                                              Matrix3              output);
+                                              GeglMatrix3          output);
 static GeglRectangle get_bounding_box       (GeglOperation       *op);
 static GeglRectangle get_invalidated_by_change (GeglOperation       *operation,
                                               const gchar         *input_pad,
@@ -256,7 +255,7 @@
 static void
 op_affine_init (OpAffine *self)
 {
-  matrix3_identity (self->matrix);
+  gegl_matrix3_identity (self->matrix);
 }
 
 static void
@@ -406,8 +405,8 @@
 }
 
 static void
-get_source_matrix (OpAffine *affine,
-                   Matrix3   output)
+get_source_matrix (OpAffine     *affine,
+                   GeglMatrix3   output)
 {
   GSList        *connections;
   GeglOperation *op = GEGL_OPERATION (affine);
@@ -420,7 +419,7 @@
   source = gegl_connection_get_source_node (connections->data)->operation;
   g_assert (IS_OP_AFFINE (source));
 
-  matrix3_copy (output, OP_AFFINE (source)->matrix);
+  gegl_matrix3_copy (output, OP_AFFINE (source)->matrix);
 }
 
 static GeglRectangle
@@ -445,21 +444,21 @@
 
   /* invoke child's matrix creation function */
   g_assert (klass->create_matrix);
-  matrix3_identity (affine->matrix);
+  gegl_matrix3_identity (affine->matrix);
   klass->create_matrix (op, affine->matrix);
 
   if (affine->origin_x || affine->origin_y)
-    matrix3_originate (affine->matrix, affine->origin_x, affine->origin_y);
+    gegl_matrix3_originate (affine->matrix, affine->origin_x, affine->origin_y);
 
   if (is_composite_node (affine))
     {
-      Matrix3 source;
+      GeglMatrix3 source;
 
       get_source_matrix (affine, source);
-      matrix3_multiply (source, affine->matrix, affine->matrix);
+      gegl_matrix3_multiply (source, affine->matrix, affine->matrix);
     }
   if (is_intermediate_node (affine) ||
-      matrix3_is_identity (affine->matrix))
+      gegl_matrix3_is_identity (affine->matrix))
     {
       return in_rect;
     }
@@ -482,7 +481,7 @@
   have_points [7] = in_rect.y + in_rect.height ;
 
   for (i = 0; i < 8; i += 2)
-    matrix3_transform_point (affine->matrix,
+    gegl_matrix3_transform_point (affine->matrix,
                              have_points + i, have_points + i + 1);
 
   bounding_box (have_points, 4, &have_rect);
@@ -497,12 +496,12 @@
   GeglNode *source_node = gegl_operation_get_source_node (operation, "input");
 
   OpAffine *affine = (OpAffine *) operation;
-  Matrix3   inverse;
+  GeglMatrix3   inverse;
   gdouble   need_points [2];
   gint      i;
 
   if (is_intermediate_node (affine) ||
-      matrix3_is_identity (inverse))
+      gegl_matrix3_is_identity (inverse))
     {
       return gegl_operation_detect (source_node->operation, x, y);
     }
@@ -510,11 +509,11 @@
   need_points [0] = x;
   need_points [1] = y;
 
-  matrix3_copy (inverse, affine->matrix);
-  matrix3_invert (inverse);
+  gegl_matrix3_copy (inverse, affine->matrix);
+  gegl_matrix3_invert (inverse);
 
   for (i = 0; i < 2; i += 2)
-    matrix3_transform_point (inverse,
+    gegl_matrix3_transform_point (inverse,
                              need_points + i, need_points + i + 1);
 
   return gegl_operation_detect (source_node->operation,
@@ -527,7 +526,7 @@
                          const GeglRectangle *region)
 {
   OpAffine      *affine = (OpAffine *) op;
-  Matrix3        inverse;
+  GeglMatrix3    inverse;
   GeglRectangle  requested_rect,
                  need_rect;
   GeglRectangle  context_rect;
@@ -539,11 +538,11 @@
   sampler = affine->sampler;
   context_rect = sampler->context_rect;
 
-  matrix3_copy (inverse, affine->matrix);
-  matrix3_invert (inverse);
+  gegl_matrix3_copy (inverse, affine->matrix);
+  gegl_matrix3_invert (inverse);
 
   if (is_intermediate_node (affine) ||
-      matrix3_is_identity (inverse))
+      gegl_matrix3_is_identity (inverse))
     {
       return requested_rect;
     }
@@ -560,11 +559,11 @@
   need_points [6] = requested_rect.x;
   need_points [7] = requested_rect.y + requested_rect.height ;
 
-  matrix3_copy (inverse, affine->matrix);
-  matrix3_invert (inverse);
+  gegl_matrix3_copy (inverse, affine->matrix);
+  gegl_matrix3_invert (inverse);
 
   for (i = 0; i < 8; i += 2)
-    matrix3_transform_point (inverse,
+    gegl_matrix3_transform_point (inverse,
                              need_points + i, need_points + i + 1);
   bounding_box (need_points, 4, &need_rect);
 
@@ -594,21 +593,21 @@
   context_rect = sampler->context_rect;
   /* invoke child's matrix creation function */
   g_assert (klass->create_matrix);
-  matrix3_identity (affine->matrix);
+  gegl_matrix3_identity (affine->matrix);
   klass->create_matrix (op, affine->matrix);
 
   if (affine->origin_x || affine->origin_y)
-    matrix3_originate (affine->matrix, affine->origin_x, affine->origin_y);
+    gegl_matrix3_originate (affine->matrix, affine->origin_x, affine->origin_y);
 
   if (is_composite_node (affine))
     {
-      Matrix3 source;
+      GeglMatrix3 source;
 
       get_source_matrix (affine, source);
-      matrix3_multiply (source, affine->matrix, affine->matrix);
+      gegl_matrix3_multiply (source, affine->matrix, affine->matrix);
     }
   if (is_intermediate_node (affine) ||
-      matrix3_is_identity (affine->matrix))
+      gegl_matrix3_is_identity (affine->matrix))
     {
       return region;
     }
@@ -631,7 +630,7 @@
   affected_points [7] = region.y + region.height ;
 
   for (i = 0; i < 8; i += 2)
-    matrix3_transform_point (affine->matrix,
+    gegl_matrix3_transform_point (affine->matrix,
                              affected_points + i, affected_points + i + 1);
 
   bounding_box (affected_points, 4, &affected_rect);
@@ -643,7 +642,7 @@
 static void
 affine_generic (GeglBuffer        *dest,
                 GeglBuffer        *src,
-                Matrix3            matrix,
+                GeglMatrix3        matrix,
                 GeglSampler       *sampler)
 {
   GeglBufferIterator *i;
@@ -651,7 +650,7 @@
   gint                  x, y;
   gfloat               *dest_buf,
                        *dest_ptr;
-  Matrix3               inverse;
+  GeglMatrix3           inverse;
   gdouble               u_start,
                         v_start,
                         u_float,
@@ -677,8 +676,8 @@
       GeglRectangle *roi = &i->roi[0];
       dest_buf           = (gfloat *)i->data[0];
 
-      matrix3_copy (inverse, matrix);
-      matrix3_invert (inverse);
+      gegl_matrix3_copy (inverse, matrix);
+      gegl_matrix3_invert (inverse);
 
       u_start = inverse[0][0] * roi->x + inverse[0][1] * roi->y + inverse[0][2];
       v_start = inverse[1][0] * roi->x + inverse[1][1] * roi->y + inverse[1][2];
@@ -719,7 +718,7 @@
   OpAffine            *affine = (OpAffine *) operation;
 
   if (is_intermediate_node (affine) ||
-      matrix3_is_identity (affine->matrix))
+      gegl_matrix3_is_identity (affine->matrix))
     {
       /* XXX: make the copying smarter, by perhaps even COW sharing
        * of tiles (in the gegl_buffer_copy code)
@@ -729,7 +728,7 @@
 #if 0  /* XXX: port to use newer APIs, perhaps not possible to achieve COW,
                 but should still be faster than a full resampling when it
                 is not needed */
-  else if (matrix3_is_translate (affine->matrix) &&
+  else if (gegl_matrix3_is_translate (affine->matrix) &&
            (! strcmp (affine->filter, "nearest") ||
             (affine->matrix [0][2] == (gint) affine->matrix [0][2] &&
              affine->matrix [1][2] == (gint) affine->matrix [1][2])))

Modified: trunk/operations/affine/affine.h
==============================================================================
--- trunk/operations/affine/affine.h	(original)
+++ trunk/operations/affine/affine.h	Fri Nov 28 00:11:09 2008
@@ -1,8 +1,8 @@
 #ifndef __OP_AFFINE_H__
 #define __OP_AFFINE_H__
 
-#include "matrix.h"
 #include "gegl-buffer-private.h"
+#include <gegl-matrix.h>
 
 G_BEGIN_DECLS
 
@@ -14,13 +14,13 @@
 #define OP_AFFINE_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj),  TYPE_OP_AFFINE, OpAffineClass))
 
 typedef void (*OpAffineCreateMatrixFunc) (GeglOperation *op,
-                                          Matrix3        matrix);
+                                          GeglMatrix3        matrix);
 typedef struct _OpAffine OpAffine;
 struct _OpAffine
 {
   GeglOperationFilter parent;
 
-  Matrix3      matrix;
+  GeglMatrix3  matrix;
   gdouble      origin_x,
                origin_y;
   gchar       *filter;

Modified: trunk/operations/affine/chant.h
==============================================================================
--- trunk/operations/affine/chant.h	(original)
+++ trunk/operations/affine/chant.h	Fri Nov 28 00:11:09 2008
@@ -253,7 +253,7 @@
 #endif
 
 static void create_matrix (GeglChantOperation *operation,
-                           Matrix3         matrix);
+                           GeglMatrix3         matrix);
 
 static void
 gegl_chant_class_init (ChantClass * klass)

Modified: trunk/operations/affine/reflect.c
==============================================================================
--- trunk/operations/affine/reflect.c	(original)
+++ trunk/operations/affine/reflect.c	Fri Nov 28 00:11:09 2008
@@ -40,7 +40,7 @@
 
 static void
 create_matrix (GeglChantOperation *op,
-               Matrix3        matrix)
+               GeglMatrix3        matrix)
 {
   gdouble ux=0, uy=0;
   gdouble l;

Modified: trunk/operations/affine/rotate.c
==============================================================================
--- trunk/operations/affine/rotate.c	(original)
+++ trunk/operations/affine/rotate.c	Fri Nov 28 00:11:09 2008
@@ -36,7 +36,7 @@
 
 static void
 create_matrix (GeglChantOperation *op,
-               Matrix3        matrix)
+               GeglMatrix3        matrix)
 {
   gdouble radians = op->degrees * (2 * G_PI / 360.);
 

Modified: trunk/operations/affine/scale.c
==============================================================================
--- trunk/operations/affine/scale.c	(original)
+++ trunk/operations/affine/scale.c	Fri Nov 28 00:11:09 2008
@@ -36,7 +36,7 @@
 
 static void
 create_matrix (GeglChantOperation *op,
-               Matrix3        matrix)
+               GeglMatrix3         matrix)
 {
   matrix [0][0] = op->x;
   matrix [1][1] = op->y;

Modified: trunk/operations/affine/shear.c
==============================================================================
--- trunk/operations/affine/shear.c	(original)
+++ trunk/operations/affine/shear.c	Fri Nov 28 00:11:09 2008
@@ -38,7 +38,7 @@
 
 static void
 create_matrix (GeglChantOperation *op,
-               Matrix3        matrix)
+               GeglMatrix3         matrix)
 {
   matrix [0][1] = op->x;
   matrix [1][0] = op->y;

Modified: trunk/operations/affine/transform.c
==============================================================================
--- trunk/operations/affine/transform.c	(original)
+++ trunk/operations/affine/transform.c	Fri Nov 28 00:11:09 2008
@@ -35,24 +35,9 @@
 
 static void
 create_matrix (GeglChantOperation *op,
-               Matrix3        matrix)
+               GeglMatrix3         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;
+  gegl_matrix3_parse_string (matrix, op->transform);
 }
 
 #endif

Modified: trunk/operations/affine/translate.c
==============================================================================
--- trunk/operations/affine/translate.c	(original)
+++ trunk/operations/affine/translate.c	Fri Nov 28 00:11:09 2008
@@ -38,7 +38,7 @@
 
 static void
 create_matrix (GeglChantOperation *op,
-               Matrix3        matrix)
+               GeglMatrix3         matrix)
 {
   matrix [0][2] = op->x;
   matrix [1][2] = op->y;



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