[gimp/warp-wip-rebased: 37/56] warp-tool: implement swirl clockwise and counter-clockwise



commit 7ff91160b5ff70020f559448eafec0ee3f0a22aa
Author: Michael Muré <batolettre gmail com>
Date:   Fri Jul 1 18:13:22 2011 +0200

    warp-tool: implement swirl clockwise and counter-clockwise

 app/gegl/gimp-gegl-enums.c   |    4 ++++
 app/gegl/gimp-gegl-enums.h   |    4 +++-
 app/gegl/gimpoperationwarp.c |    8 ++++++++
 3 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/app/gegl/gimp-gegl-enums.c b/app/gegl/gimp-gegl-enums.c
index ee77740..4aa144a 100644
--- a/app/gegl/gimp-gegl-enums.c
+++ b/app/gegl/gimp-gegl-enums.c
@@ -46,6 +46,8 @@ gimp_warp_behavior_get_type (void)
     { GIMP_WARP_BEHAVIOR_MOVE, "GIMP_WARP_BEHAVIOR_MOVE", "move" },
     { GIMP_WARP_BEHAVIOR_GROW, "GIMP_WARP_BEHAVIOR_GROW", "grow" },
     { GIMP_WARP_BEHAVIOR_SHRINK, "GIMP_WARP_BEHAVIOR_SHRINK", "shrink" },
+    { GIMP_WARP_BEHAVIOR_SWIRL_CW, "GIMP_WARP_BEHAVIOR_SWIRL_CW", "swirl-cw" },
+    { GIMP_WARP_BEHAVIOR_SWIRL_CCW, "GIMP_WARP_BEHAVIOR_SWIRL_CCW", "swirl-ccw" },
     { 0, NULL, NULL }
   };
 
@@ -54,6 +56,8 @@ gimp_warp_behavior_get_type (void)
     { GIMP_WARP_BEHAVIOR_MOVE, NC_("warp-behavior", "Move pixels"), NULL },
     { GIMP_WARP_BEHAVIOR_GROW, NC_("warp-behavior", "Grow area"), NULL },
     { GIMP_WARP_BEHAVIOR_SHRINK, NC_("warp-behavior", "Shrink area"), NULL },
+    { GIMP_WARP_BEHAVIOR_SWIRL_CW, NC_("warp-behavior", "Swirl clockwise"), NULL },
+    { GIMP_WARP_BEHAVIOR_SWIRL_CCW, NC_("warp-behavior", "Swirl counter-clockwise"), NULL },
     { 0, NULL, NULL }
   };
 
diff --git a/app/gegl/gimp-gegl-enums.h b/app/gegl/gimp-gegl-enums.h
index ea0ab68..f7fd03b 100644
--- a/app/gegl/gimp-gegl-enums.h
+++ b/app/gegl/gimp-gegl-enums.h
@@ -39,7 +39,9 @@ typedef enum
 {
   GIMP_WARP_BEHAVIOR_MOVE,        /*< desc="Move pixels"                         >*/
   GIMP_WARP_BEHAVIOR_GROW,        /*< desc="Grow area"                           >*/
-  GIMP_WARP_BEHAVIOR_SHRINK       /*< desc="Shrink area"                         >*/
+  GIMP_WARP_BEHAVIOR_SHRINK,      /*< desc="Shrink area"                         >*/
+  GIMP_WARP_BEHAVIOR_SWIRL_CW,    /*< desc="Swirl clockwise"                     >*/
+  GIMP_WARP_BEHAVIOR_SWIRL_CCW    /*< desc="Swirl counter-clockwise"             >*/
 } GimpWarpBehavior;
 
 #endif /* __GIMP_GEGL_ENUMS_H__ */
diff --git a/app/gegl/gimpoperationwarp.c b/app/gegl/gimpoperationwarp.c
index 9326aaf..7f8d5c1 100644
--- a/app/gegl/gimpoperationwarp.c
+++ b/app/gegl/gimpoperationwarp.c
@@ -300,6 +300,14 @@ gimp_operation_warp_stamp (GimpOperationWarp *ow,
                 coords[0] += influence * (x_iter - x) / ow->size;
                 coords[1] += influence * (y_iter - y) / ow->size;
                 break;
+              case GIMP_WARP_BEHAVIOR_SWIRL_CW:
+                coords[0] += influence * (y_iter - y) / ow->size;
+                coords[1] -= influence * (x_iter - x) / ow->size;
+                break;
+              case GIMP_WARP_BEHAVIOR_SWIRL_CCW:
+                coords[0] -= influence * (y_iter - y) / ow->size;
+                coords[1] += influence * (x_iter - x) / ow->size;
+                break;
             }
 
           coords += 2;


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