Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gimp/ChangeLog,v
retrieving revision 1.13531
diff -u -3 -r1.13531 ChangeLog
--- ChangeLog	27 Oct 2006 13:52:34 -0000	1.13531
+++ ChangeLog	28 Oct 2006 10:05:40 -0000
@@ -1,3 +1,11 @@
+2006-10-28 Joao S. O. Bueno Calligaris <gwidion@mpc.com.br>
+	* app/vectors/gimpstroke.[ch]
+	* tools/pdbgen/pdb/vectors.pdb
+	* plug-ins/pygimp/pygimp-vectors.c:  Added support for stroke rotate,
+	flip and free flip
+	* app/tools/vectors_cmds.c
+	* libgimp/gimpvectors_pdb.[ch]: regenerated
+
 2006-10-27  Sven Neumann  <sven@gimp.org>
 
 	* libgimpconfig/gimpcolorconfig-enums.[ch]
@@ -77,7 +85,7 @@
 2006-10-26  Kevin Cozens  <kcozens@cvs.gnome.org>
 
 	* plug-ins/script-fu/scripts/script-fu-compat.init: Added strbreakup,
-	strcat, strcmp, string-trim, string-trim-left, string-trim-right, and 
+	strcat, strcmp, string-trim, string-trim-left, string-trim-right, and
 	unstrbreakup.
 
 2006-10-26  Jakub Steiner <jimmac@ximian.com>
@@ -228,7 +236,7 @@
 	* libgimpthumb/gimpthumb.def
 	* libgimpwidgets/gimpwidgets.def: .def-file maintenance. Hope my
 	changes are correct...
-	
+
 	With the help from
 	   nm .libs/libgimpfoo-2.0.so |\
 	   sed -ne "s/.* T \([a-zA-Z0-9][a-zA-Z0-9_]*\)/\t\1/p" |\
@@ -442,7 +450,7 @@
 	* configure.in: use LIBLCMS instead of LCMS_LIBS.
 
 	* modules/Makefile.am: changed accordingly.
-	
+
 	* plug-ins/common/mkgen.pl: link plug-ins with the same libraries
 	and in the same order as defined in the gimp.pc and gimpui.pc files.
 
@@ -561,7 +569,7 @@
 
 	* plug-ins/pygimp/plug-ins/gtkcons.py: removed.
 
-	* plug-ins/gimpcons.py: use new console widget, and the 
+	* plug-ins/gimpcons.py: use new console widget, and the
 	GimpProcBrowserDialog binding directly. Still a little rough in
 	places.
 
@@ -850,7 +858,7 @@
 2006-10-16  Kevin Cozens  <kcozens@cvs.gnome.org>
 
 	* configure.in: Set enable_python to yes if it wasn't set to no.
-	Fixes display of Python status in "Optional Plug-Ins" section. 
+	Fixes display of Python status in "Optional Plug-Ins" section.
 
 	* plug-ins/script-fu/scripts/script-fu-compat.init: Added
 	'the-environment'.
@@ -1075,7 +1083,7 @@
 	* plug-ins/common/gif.c (bad_bounds_dialog): improved warning dialog.
 
 2006-10-11  Michael Schumacher  <schumaml@cvs.gnome.org>
-	
+
 	* libgimpthumb/gimpthumb.def: added gimp_thumb_file_type_get_type
 
 2006-10-11  Bill Skaggs  <weskaggs@primate.ucdavis.edu>
Index: app/vectors/gimpstroke.c
===================================================================
RCS file: /cvs/gnome/gimp/app/vectors/gimpstroke.c,v
retrieving revision 1.59
diff -u -3 -r1.59 gimpstroke.c
--- app/vectors/gimpstroke.c	15 May 2006 09:46:21 -0000	1.59
+++ app/vectors/gimpstroke.c	28 Oct 2006 10:05:40 -0000
@@ -27,6 +27,7 @@
 
 #include "core/gimp-utils.h"
 #include "core/gimpcoords.h"
+#include "core/gimp-transform-utils.h"
 
 #include "gimpanchor.h"
 #include "gimpstroke.h"
@@ -134,6 +135,18 @@
 static void         gimp_stroke_real_scale           (GimpStroke       *stroke,
                                                       gdouble           scale_x,
                                                       gdouble           scale_y);
+static void         gimp_stroke_real_rotate          (GimpStroke *stroke,
+                                                      gdouble     center_x,
+                                                      gdouble     center_y,
+                                                      gdouble     angle);
+static void         gimp_stroke_real_flip            (GimpStroke          *stroke,
+                                                      GimpOrientationType  flip_type,
+                                                      gdouble              axis);
+static void         gimp_stroke_real_flip_free       (GimpStroke          *stroke,
+                                                      gdouble              x1,
+                                                      gdouble              y1,
+                                                      gdouble              x2,
+                                                      gdouble              y2);
 static void         gimp_stroke_real_transform       (GimpStroke        *stroke,
                                                       const GimpMatrix3 *matrix);
 
@@ -204,8 +217,12 @@
 
   klass->translate                = gimp_stroke_real_translate;
   klass->scale                    = gimp_stroke_real_scale;
+  klass->rotate                   = gimp_stroke_real_rotate;
+  klass->flip                     = gimp_stroke_real_flip;
+  klass->flip_free                = gimp_stroke_real_flip_free;
   klass->transform                = gimp_stroke_real_transform;
 
+
   klass->get_draw_anchors         = gimp_stroke_real_get_draw_anchors;
   klass->get_draw_controls        = gimp_stroke_real_get_draw_controls;
   klass->get_draw_lines           = gimp_stroke_real_get_draw_lines;
@@ -1055,6 +1072,89 @@
       anchor->position.x *= scale_x;
       anchor->position.y *= scale_y;
     }
+}
+
+void
+gimp_stroke_rotate (GimpStroke *stroke,
+                    gdouble     center_x,
+                    gdouble     center_y,
+                    gdouble     angle)
+{
+  g_return_if_fail (GIMP_IS_STROKE (stroke));
+
+  GIMP_STROKE_GET_CLASS (stroke)->rotate (stroke, center_x, center_y, angle);
+}
+
+static void
+gimp_stroke_real_rotate (GimpStroke *stroke,
+                         gdouble     center_x,
+                         gdouble     center_y,
+                         gdouble     angle)
+{
+  GimpMatrix3  matrix;
+
+  angle = angle / 180.0 * G_PI;
+  gimp_matrix3_identity (&matrix);
+  gimp_transform_matrix_rotate_center (&matrix, center_x, center_y, angle);
+
+  gimp_stroke_transform (stroke, &matrix);
+}
+
+void
+gimp_stroke_flip   (GimpStroke          *stroke,
+                    GimpOrientationType  flip_type,
+                    gdouble                axis)
+{
+  g_return_if_fail (GIMP_IS_STROKE (stroke));
+
+  GIMP_STROKE_GET_CLASS (stroke)->flip (stroke, flip_type, axis);
+}
+
+static void
+gimp_stroke_real_flip   (GimpStroke          *stroke,
+                         GimpOrientationType  flip_type,
+                         gdouble              axis)
+{
+  GimpMatrix3  matrix;
+
+  gimp_matrix3_identity (&matrix);
+  gimp_transform_matrix_flip (&matrix, flip_type, axis);
+  gimp_stroke_transform (stroke, &matrix);
+}
+
+void
+gimp_stroke_flip_free   (GimpStroke          *stroke,
+                         gdouble              x1,
+                         gdouble              y1,
+                         gdouble              x2,
+                         gdouble              y2)
+{
+  g_return_if_fail (GIMP_IS_STROKE (stroke));
+
+  GIMP_STROKE_GET_CLASS (stroke)->flip_free (stroke, x1, y1, x2, y2);
+}
+
+static void
+gimp_stroke_real_flip_free   (GimpStroke          *stroke,
+                              gdouble              x1,
+                              gdouble              y1,
+                              gdouble              x2,
+                              gdouble              y2)
+{
+  /* x, y, width and height parameter in gimp_transform_matrix_flip_free are unused */
+  #define flip_free_bogus_coord 0
+  GimpMatrix3  matrix;
+
+  gimp_matrix3_identity (&matrix);
+  gimp_transform_matrix_flip_free (&matrix,
+                                   flip_free_bogus_coord,
+                                   flip_free_bogus_coord,
+                                   flip_free_bogus_coord,
+                                   flip_free_bogus_coord,
+                                   x1, y1, x2, y2);
+
+  gimp_stroke_transform (stroke, &matrix);
+  #undef flip_free_bogus_coord
 }
 
 void
Index: app/vectors/gimpstroke.h
===================================================================
RCS file: /cvs/gnome/gimp/app/vectors/gimpstroke.h,v
retrieving revision 1.41
diff -u -3 -r1.41 gimpstroke.h
--- app/vectors/gimpstroke.h	26 Oct 2006 17:23:34 -0000	1.41
+++ app/vectors/gimpstroke.h	28 Oct 2006 10:05:40 -0000
@@ -157,6 +157,18 @@
   void          (* scale)                (GimpStroke            *stroke,
                                           gdouble                scale_x,
                                           gdouble                scale_y);
+  void          (* rotate)               (GimpStroke            *stroke,
+                                          gdouble                center_x,
+                                          gdouble                center_y,
+                                          gdouble                angle);
+  void          (* flip)                 (GimpStroke             *stroke,
+                                          GimpOrientationType    flip_type,
+                                          gdouble                axis);
+  void          (* flip_free)            (GimpStroke            *stroke,
+                                          gdouble                x1,
+                                          gdouble                y1,
+                                          gdouble                x2,
+                                          gdouble                y2);
   void          (* transform)            (GimpStroke            *stroke,
                                           const GimpMatrix3     *matrix);
 
@@ -308,6 +320,18 @@
 void         gimp_stroke_scale                (GimpStroke            *stroke,
                                                gdouble                scale_x,
                                                gdouble                scale_y);
+void         gimp_stroke_rotate               (GimpStroke            *stroke,
+                                               gdouble                center_x,
+                                               gdouble                center_y,
+                                               gdouble                angle);
+void         gimp_stroke_flip                 (GimpStroke             *stroke,
+                                               GimpOrientationType    flip_type,
+                                               gdouble                axis);
+void         gimp_stroke_flip_free            (GimpStroke            *stroke,
+                                               gdouble                x1,
+                                               gdouble                y1,
+                                               gdouble                x2,
+                                               gdouble                y2);
 void         gimp_stroke_transform            (GimpStroke            *stroke,
                                                const GimpMatrix3     *matrix);
 
Index: tools/pdbgen/pdb/vectors.pdb
===================================================================
RCS file: /cvs/gnome/gimp/tools/pdbgen/pdb/vectors.pdb,v
retrieving revision 1.25
diff -u -3 -r1.25 vectors.pdb
--- tools/pdbgen/pdb/vectors.pdb	26 Oct 2006 17:23:41 -0000	1.25
+++ tools/pdbgen/pdb/vectors.pdb	28 Oct 2006 10:05:41 -0000
@@ -525,6 +525,114 @@
     );
 }
 
+sub vectors_stroke_rotate {
+    $blurb = 'rotates the given stroke.';
+
+    $help = <<'HELP';
+Rotates the given stroke around given center by angle (in degrees).
+HELP
+
+    &joao_pdb_misc('2006', '2.4');
+    @inargs = (
+	{ name => 'vectors', type => 'vectors',
+	  desc => 'The vectors object' },
+	{ name => 'stroke_id', type => 'int32',
+	  desc => 'The stroke ID' },
+	{ name => "center_x", type => 'float',
+	  desc => "X coordinate of the rotation center" },
+	{ name => "center_y", type => 'float',
+	  desc => "Y coordinate of the rotation center" },
+        { name => "angle", type => 'float',
+	  desc => "angle to rotate about" }
+    );
+
+    %invoke = (
+        code => <<"CODE"
+{
+  GimpStroke *stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
+  
+  if (stroke)
+    gimp_stroke_rotate (stroke, center_x, center_y, angle);
+  else
+    success = FALSE;
+}
+CODE
+    );
+}
+
+sub vectors_stroke_flip {
+    $blurb = 'flips the given stroke.';
+
+    $help = <<'HELP';
+Rotates the given stroke around given center by angle (in degrees).
+HELP
+
+    &joao_pdb_misc('2006', '2.4');
+    @inargs = (
+	{ name => 'vectors', type => 'vectors',
+	  desc => 'The vectors object' },
+	{ name => 'stroke_id', type => 'int32',
+	  desc => 'The stroke ID' },
+	{ name => "flip_type",
+	  type => 'enum GimpOrientationType (no GIMP_ORIENTATION_UNKNOWN)',
+	  desc => "Flip orientation, either vertical or horizontal" },
+	{ name => "axis", type => 'float',
+	  desc => "axis coordinate about which to flip, in pixels" }
+    );
+
+    %invoke = (
+        code => <<"CODE"
+{
+  GimpStroke *stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
+  
+  if (stroke)
+    gimp_stroke_flip (stroke, flip_type, axis);
+  else
+    success = FALSE;
+}
+CODE
+    );
+}
+
+sub vectors_stroke_flip_free {
+    $blurb = 'flips the given stroke about an arbitrary axis.';
+
+    $help = <<'HELP';
+Flips the given stroke about an arbitrary axis. Axis is defined by two coordinates
+in the image (in pixels), through which the flipping axis passes.
+HELP
+
+    &joao_pdb_misc('2006', '2.4');
+    @inargs = (
+	{ name => 'vectors', type => 'vectors',
+	  desc => 'The vectors object' },
+	{ name => 'stroke_id', type => 'int32',
+	  desc => 'The stroke ID' },
+	{ name => "x1", type => 'float',
+	  desc => "X coordinate of the first point of the flipping axis" },
+	{ name => "y1", type => 'float',
+	  desc => "Y coordinate of the first point of the flipping axis" },
+	{ name => "x2", type => 'float',
+	  desc => "X coordinate of the second point of the flipping axis" },
+	{ name => "y2", type => 'float',
+	  desc => "Y coordinate of the second point of the flipping axis" },
+
+    );
+
+    %invoke = (
+        code => <<"CODE"
+{
+  GimpStroke *stroke = gimp_vectors_stroke_get_by_ID (vectors, stroke_id);
+  
+  if (stroke)
+    gimp_stroke_flip_free (stroke, x1, y1, x2, y2);
+  else
+    success = FALSE;
+}
+CODE
+    );
+}
+
 sub vectors_stroke_get_points {
     $blurb = 'returns the control points of a stroke.';
 
@@ -1158,6 +1266,9 @@
             vectors_stroke_close
             vectors_stroke_translate
             vectors_stroke_scale
+            vectors_stroke_rotate
+            vectors_stroke_flip
+            vectors_stroke_flip_free
             vectors_stroke_get_points
             vectors_stroke_new_from_points
             vectors_stroke_interpolate
Index: plug-ins/pygimp/pygimp-vectors.c
===================================================================
RCS file: /cvs/gnome/gimp/plug-ins/pygimp/pygimp-vectors.c,v
retrieving revision 1.4
diff -u -3 -r1.4 pygimp-vectors.c
--- plug-ins/pygimp/pygimp-vectors.c	27 Oct 2006 07:17:13 -0000	1.4
+++ plug-ins/pygimp/pygimp-vectors.c	28 Oct 2006 10:05:41 -0000
@@ -124,6 +124,61 @@
 }
 
 static PyObject *
+vs_rotate(PyGimpVectorsStroke *self, PyObject *args, PyObject *kwargs)
+{
+    double center_x, center_y, angle;
+
+    static char *kwlist[] = { "center_x", "center_y", "angle", NULL };
+
+    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ddd:rotate", kwlist,
+                                     &center_x, &center_y, &angle))
+        return NULL;
+
+    gimp_vectors_stroke_rotate(self->vectors_ID, self->stroke, center_x,
+                               center_y, angle);
+
+    Py_INCREF(Py_None);
+    return Py_None;
+}
+
+static PyObject *
+vs_flip(PyGimpVectorsStroke *self, PyObject *args, PyObject *kwargs)
+{
+    int    flip_type;
+    double axis;
+
+    static char *kwlist[] = { "flip_type", "axis", NULL };
+
+    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "id:rotate", kwlist,
+                                     &flip_type, &axis))
+        return NULL;
+
+    gimp_vectors_stroke_flip(self->vectors_ID, self->stroke, flip_type, axis);
+
+    Py_INCREF(Py_None);
+    return Py_None;
+}
+
+static PyObject *
+vs_flip_free(PyGimpVectorsStroke *self, PyObject *args, PyObject *kwargs)
+{
+    double x1,y1,x2,y2;
+
+    static char *kwlist[] = { "x1", "y1", "x2", "y2", NULL };
+
+    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "dddd:rotate", kwlist,
+                                     &x1, &y1, &x2, &y2))
+        return NULL;
+
+    gimp_vectors_stroke_flip_free(self->vectors_ID, self->stroke,
+                                  x1, y1, x2, y2);
+    Py_INCREF(Py_None);
+    return Py_None;
+}
+
+
+
+static PyObject *
 vs_interpolate(PyGimpVectorsStroke *self, PyObject *args, PyObject *kwargs)
 {
     double precision;
@@ -166,6 +221,9 @@
     { "close", (PyCFunction)vs_close, METH_NOARGS },
     { "translate", (PyCFunction)vs_translate, METH_VARARGS | METH_KEYWORDS },
     { "scale", (PyCFunction)vs_scale, METH_VARARGS | METH_KEYWORDS },
+    { "rotate", (PyCFunction)vs_rotate, METH_VARARGS | METH_KEYWORDS },
+    { "flip", (PyCFunction)vs_flip, METH_VARARGS | METH_KEYWORDS },
+    { "flip_free", (PyCFunction)vs_flip_free, METH_VARARGS | METH_KEYWORDS },
     { "interpolate", (PyCFunction)vs_interpolate, METH_VARARGS | METH_KEYWORDS },
     { NULL, NULL, 0 }
 };
