[gimp/soc-2012-unified-transformation: 14/51] transformtool: Make rotate op behave as spec
- From: Mikael Magnusson <mikachu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/soc-2012-unified-transformation: 14/51] transformtool: Make rotate op behave as spec
- Date: Mon, 20 Aug 2012 13:51:56 +0000 (UTC)
commit 81cb334d945f1a125250211e517bb61a0a3e47d9
Author: Mikael Magnusson <mikachu src gnome org>
Date: Thu Jun 14 09:10:00 2012 +0200
transformtool: Make rotate op behave as spec
app/tools/gimpunifiedtransformtool.c | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/app/tools/gimpunifiedtransformtool.c b/app/tools/gimpunifiedtransformtool.c
index d72adcf..73aaeb8 100644
--- a/app/tools/gimpunifiedtransformtool.c
+++ b/app/tools/gimpunifiedtransformtool.c
@@ -780,6 +780,27 @@ gimp_unified_transform_tool_motion (GimpTransformTool *transform_tool)
}
}
+ if (function == TRANSFORM_HANDLE_ROTATION)
+ {
+ GimpVector2 m = { .x = transform_tool->curx, .y = transform_tool->cury };
+ GimpVector2 p = { .x = transform_tool->mousex, .y = transform_tool->mousey };
+ GimpVector2 c = { .x = ppivot_x, .y = ppivot_y };
+ gdouble angle = calcangle (vectorsubtract (m, c), vectorsubtract (p, c));
+ if (constrain)
+ {
+ /* round to 15 degree multiple */
+ angle /= 2*G_PI/24.;
+ angle = round (angle);
+ angle *= 2*G_PI/24.;
+ }
+ for (i = 0; i < 4; i++) {
+ p.x = px[i]; p.y = py[i];
+ m = vectoradd (c, rotate2d (vectorsubtract (p, c), angle));
+ *x[i] = m.x;
+ *y[i] = m.y;
+ }
+ }
+
/* old code below */
#if 0
if (options->alternate)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]