[gimp/soc-2011-warp: 50/56] app: change interpolation for warp tool
- From: Michael Murà <mmure src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/soc-2011-warp: 50/56] app: change interpolation for warp tool
- Date: Sat, 23 Jul 2011 20:09:13 +0000 (UTC)
commit 6e1ea21c529cb9702e3cb2488a588cae0e2d4d1c
Author: Alexia Death <alexiadeath gmail com>
Date: Fri Jul 8 09:07:41 2011 +0300
app: change interpolation for warp tool
app/gegl/gimpoperationwarp.c | 35 +++++++++++++++++++++++++----------
1 files changed, 25 insertions(+), 10 deletions(-)
---
diff --git a/app/gegl/gimpoperationwarp.c b/app/gegl/gimpoperationwarp.c
index 84db9fe..4ccdb83 100644
--- a/app/gegl/gimpoperationwarp.c
+++ b/app/gegl/gimpoperationwarp.c
@@ -255,7 +255,10 @@ gimp_operation_warp_process (GeglOperation *operation,
const GeglRectangle *roi)
{
GimpOperationWarp *ow = GIMP_OPERATION_WARP (operation);
- gdouble distance;
+ gdouble dist;
+ gdouble stamps;
+ gdouble spacing = MAX (ow->size * 0.01, 0.5); /*1% spacing for starters*/
+
Point prev, next, lerp;
gulong i;
GeglPathList *event;
@@ -270,19 +273,31 @@ gimp_operation_warp_process (GeglOperation *operation,
while (event->next)
{
+
event = event->next;
next = *(event->d.point);
+ dist = point_dist (&next, &prev);
+ stamps = dist / spacing;
/* we are doing a sort of interpolation 3d throught x,y and time */
- distance = sqrt (POW2(point_dist (&next, &prev)) + POW2(STROKE_RATE));
-
- for (i = 0; i <= distance; i++)
- {
- point_lerp (&lerp, &prev, &next, i / distance);
- gimp_operation_warp_stamp (ow, lerp.x, lerp.y);
- }
-
- prev = next;
+ /*distance = sqrt (POW2() + POW2(STROKE_RATE)); Weird stuff... */
+
+ if (stamps < 1)
+ {
+ gimp_operation_warp_stamp (ow, next.x, next.y);
+ prev = next;
+ }
+ else
+ {
+ for (i = 0; i < stamps; i++)
+ {
+ point_lerp (&lerp, &prev, &next, (i * spacing) / dist);
+ gimp_operation_warp_stamp (ow, lerp.x, lerp.y);
+ }
+ prev = lerp;
+ }
+
+
}
/* Affect the output buffer */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]