[gimp/soc-2011-warp] gimpoperationwarp: implement grow ans shrink behavior
- From: Michael Murà <mmure src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/soc-2011-warp] gimpoperationwarp: implement grow ans shrink behavior
- Date: Tue, 21 Jun 2011 10:24:39 +0000 (UTC)
commit b280ae3853ce549a87ee2358ba368ce2abf0f957
Author: Michael Murà <batolettre gmail com>
Date: Tue Jun 21 12:23:59 2011 +0200
gimpoperationwarp: implement grow ans shrink behavior
app/gegl/gimp-gegl-enums.c | 4 ++++
app/gegl/gimp-gegl-enums.h | 2 ++
app/gegl/gimpoperationwarp.c | 10 +++++++++-
3 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/app/gegl/gimp-gegl-enums.c b/app/gegl/gimp-gegl-enums.c
index c53ed77..de60ed5 100644
--- a/app/gegl/gimp-gegl-enums.c
+++ b/app/gegl/gimp-gegl-enums.c
@@ -44,12 +44,16 @@ gimp_warp_behavior_get_type (void)
static const GEnumValue values[] =
{
{ 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" },
{ 0, NULL, NULL }
};
static const GimpEnumDesc descs[] =
{
{ 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 },
{ 0, NULL, NULL }
};
diff --git a/app/gegl/gimp-gegl-enums.h b/app/gegl/gimp-gegl-enums.h
index 1615be3..7a28b8a 100644
--- a/app/gegl/gimp-gegl-enums.h
+++ b/app/gegl/gimp-gegl-enums.h
@@ -38,6 +38,8 @@ GType gimp_warp_behavior_get_type (void) G_GNUC_CONST;
typedef enum
{
GIMP_WARP_BEHAVIOR_MOVE, /*< desc="Move pixels" >*/
+ GIMP_WARP_BEHAVIOR_GROW, /*< desc="Grow area" >*/
+ GIMP_WARP_BEHAVIOR_SHRINK /*< desc="Shrink area" >*/
} GimpWarpBehavior;
#endif /* __GIMP_GEGL_ENUMS_H__ */
diff --git a/app/gegl/gimpoperationwarp.c b/app/gegl/gimpoperationwarp.c
index 1ad0158..a7d0766 100644
--- a/app/gegl/gimpoperationwarp.c
+++ b/app/gegl/gimpoperationwarp.c
@@ -210,7 +210,7 @@ gimp_operation_warp_process (GeglOperation *operation,
ow->buffer = gegl_buffer_dup (in_buf);
/* Compute the stamps location */
- length = (gulong) gegl_path_get_length (ow->stroke);
+ length = (gulong) gegl_path_get_length (ow->stroke) + 1;
x = g_slice_alloc (length * sizeof(gdouble));
y = g_slice_alloc (length * sizeof(gdouble));
@@ -285,6 +285,14 @@ gimp_operation_warp_stamp (GimpOperationWarp *ow,
coords[0] += influence * (ow->last_x - x);
coords[1] += influence * (ow->last_y - y);
break;
+ case GIMP_WARP_BEHAVIOR_GROW:
+ coords[0] -= influence * (x_iter - x) / ow->size;
+ coords[1] -= influence * (y_iter - y) / ow->size;
+ break;
+ case GIMP_WARP_BEHAVIOR_SHRINK:
+ coords[0] += influence * (x_iter - x) / ow->size;
+ coords[1] += influence * (y_iter - y) / ow->size;
+ break;
}
coords += 2;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]