[gimp/soc-2012-unified-transformation: 10/21] transformtool: Add temporary new handles
- From: Mikael Magnusson <mikachu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/soc-2012-unified-transformation: 10/21] transformtool: Add temporary new handles
- Date: Sat, 16 Jun 2012 12:40:33 +0000 (UTC)
commit 041afdee361023e5f29a9aed44e10d3e7251dda8
Author: Mikael Magnusson <mikachu src gnome org>
Date: Thu Jun 14 02:48:44 2012 +0200
transformtool: Add temporary new handles
app/display/display-enums.c | 6 +
app/display/display-enums.h | 3 +
app/display/gimpcanvashandle.c | 27 +++
app/tools/gimptransformtool.h | 26 ++-
app/tools/gimpunifiedtransformationtool.c | 325 ++++++++++++++++++-----------
5 files changed, 257 insertions(+), 130 deletions(-)
---
diff --git a/app/display/display-enums.c b/app/display/display-enums.c
index 827d6da..28bf503 100644
--- a/app/display/display-enums.c
+++ b/app/display/display-enums.c
@@ -89,6 +89,9 @@ gimp_handle_type_get_type (void)
{ GIMP_HANDLE_FILLED_SQUARE, "GIMP_HANDLE_FILLED_SQUARE", "filled-square" },
{ GIMP_HANDLE_CIRCLE, "GIMP_HANDLE_CIRCLE", "circle" },
{ GIMP_HANDLE_FILLED_CIRCLE, "GIMP_HANDLE_FILLED_CIRCLE", "filled-circle" },
+ { GIMP_HANDLE_DIAMOND, "GIMP_HANDLE_DIAMOND", "diamond" },
+ { GIMP_HANDLE_FILLED_DIAMOND, "GIMP_HANDLE_FILLED_DIAMOND", "filled-diamond" },
+ { GIMP_HANDLE_FUNNY_PERSPECTIVE_THING_GUIGURU_CAME_UP_WITH, "GIMP_HANDLE_FUNNY_PERSPECTIVE_THING_GUIGURU_CAME_UP_WITH", "funny-perspective-thing-guiguru-came-up-with" },
{ GIMP_HANDLE_CROSS, "GIMP_HANDLE_CROSS", "cross" },
{ 0, NULL, NULL }
};
@@ -99,6 +102,9 @@ gimp_handle_type_get_type (void)
{ GIMP_HANDLE_FILLED_SQUARE, "GIMP_HANDLE_FILLED_SQUARE", NULL },
{ GIMP_HANDLE_CIRCLE, "GIMP_HANDLE_CIRCLE", NULL },
{ GIMP_HANDLE_FILLED_CIRCLE, "GIMP_HANDLE_FILLED_CIRCLE", NULL },
+ { GIMP_HANDLE_DIAMOND, "GIMP_HANDLE_DIAMOND", NULL },
+ { GIMP_HANDLE_FILLED_DIAMOND, "GIMP_HANDLE_FILLED_DIAMOND", NULL },
+ { GIMP_HANDLE_FUNNY_PERSPECTIVE_THING_GUIGURU_CAME_UP_WITH, "GIMP_HANDLE_FUNNY_PERSPECTIVE_THING_GUIGURU_CAME_UP_WITH", NULL },
{ GIMP_HANDLE_CROSS, "GIMP_HANDLE_CROSS", NULL },
{ 0, NULL, NULL }
};
diff --git a/app/display/display-enums.h b/app/display/display-enums.h
index da76552..c493a9b 100644
--- a/app/display/display-enums.h
+++ b/app/display/display-enums.h
@@ -58,6 +58,9 @@ typedef enum
GIMP_HANDLE_FILLED_SQUARE,
GIMP_HANDLE_CIRCLE,
GIMP_HANDLE_FILLED_CIRCLE,
+ GIMP_HANDLE_DIAMOND,
+ GIMP_HANDLE_FILLED_DIAMOND,
+ GIMP_HANDLE_FUNNY_PERSPECTIVE_THING_GUIGURU_CAME_UP_WITH,
GIMP_HANDLE_CROSS
} GimpHandleType;
diff --git a/app/display/gimpcanvashandle.c b/app/display/gimpcanvashandle.c
index a38e677..8ae1b41 100644
--- a/app/display/gimpcanvashandle.c
+++ b/app/display/gimpcanvashandle.c
@@ -265,6 +265,7 @@ gimp_canvas_handle_transform (GimpCanvasItem *item,
switch (private->type)
{
+ case GIMP_HANDLE_FUNNY_PERSPECTIVE_THING_GUIGURU_CAME_UP_WITH:
case GIMP_HANDLE_SQUARE:
case GIMP_HANDLE_FILLED_SQUARE:
gimp_canvas_item_shift_to_north_west (private->anchor,
@@ -277,6 +278,8 @@ gimp_canvas_handle_transform (GimpCanvasItem *item,
case GIMP_HANDLE_CIRCLE:
case GIMP_HANDLE_FILLED_CIRCLE:
case GIMP_HANDLE_CROSS:
+ case GIMP_HANDLE_DIAMOND:
+ case GIMP_HANDLE_FILLED_DIAMOND:
gimp_canvas_item_shift_to_center (private->anchor,
*x, *y,
private->width,
@@ -304,6 +307,7 @@ gimp_canvas_handle_draw (GimpCanvasItem *item,
switch (private->type)
{
+ case GIMP_HANDLE_FUNNY_PERSPECTIVE_THING_GUIGURU_CAME_UP_WITH:
case GIMP_HANDLE_SQUARE:
cairo_rectangle (cr, x, y, private->width - 1.0, private->height - 1.0);
@@ -344,6 +348,20 @@ gimp_canvas_handle_draw (GimpCanvasItem *item,
_gimp_canvas_item_stroke (item, cr);
break;
+ case GIMP_HANDLE_DIAMOND:
+ case GIMP_HANDLE_FILLED_DIAMOND:
+ cairo_move_to (cr, x, y - (gdouble) private->height / 2.0);
+ cairo_line_to (cr, x + (gdouble) private->width / 2.0, y);
+ cairo_line_to (cr, x, y + (gdouble) private->height / 2.0);
+ cairo_line_to (cr, x - (gdouble) private->width / 2.0, y);
+ cairo_line_to (cr, x, y - (gdouble) private->height / 2.0);
+
+ if (private->type == GIMP_HANDLE_DIAMOND)
+ _gimp_canvas_item_stroke (item, cr);
+ else
+ _gimp_canvas_item_fill (item, cr);
+ break;
+
default:
break;
}
@@ -361,6 +379,7 @@ gimp_canvas_handle_get_extents (GimpCanvasItem *item,
switch (private->type)
{
+ case GIMP_HANDLE_FUNNY_PERSPECTIVE_THING_GUIGURU_CAME_UP_WITH:
case GIMP_HANDLE_SQUARE:
case GIMP_HANDLE_FILLED_SQUARE:
rectangle.x = x - 1.5;
@@ -372,6 +391,8 @@ gimp_canvas_handle_get_extents (GimpCanvasItem *item,
case GIMP_HANDLE_CIRCLE:
case GIMP_HANDLE_FILLED_CIRCLE:
case GIMP_HANDLE_CROSS:
+ case GIMP_HANDLE_DIAMOND:
+ case GIMP_HANDLE_FILLED_DIAMOND:
rectangle.x = x - private->width / 2 - 1.5;
rectangle.y = y - private->height / 2 - 1.5;
rectangle.width = private->width + 3.0;
@@ -403,6 +424,7 @@ gimp_canvas_handle_hit (GimpCanvasItem *item,
switch (private->type)
{
+ case GIMP_HANDLE_FUNNY_PERSPECTIVE_THING_GUIGURU_CAME_UP_WITH:
case GIMP_HANDLE_SQUARE:
case GIMP_HANDLE_FILLED_SQUARE:
return (tx == CLAMP (tx, handle_tx, handle_tx + private->width) &&
@@ -422,6 +444,11 @@ gimp_canvas_handle_hit (GimpCanvasItem *item,
return ((SQR (handle_tx - tx) + SQR (handle_ty - ty)) < SQR (width));
}
+ case GIMP_HANDLE_DIAMOND:
+ case GIMP_HANDLE_FILLED_DIAMOND:
+ return ((ABS (handle_tx - tx) + ABS (handle_ty - ty)) < ABS (private->width));
+ break;
+
default:
break;
}
diff --git a/app/tools/gimptransformtool.h b/app/tools/gimptransformtool.h
index 587b032..7b298bb 100644
--- a/app/tools/gimptransformtool.h
+++ b/app/tools/gimptransformtool.h
@@ -22,8 +22,6 @@
#include "gimpdrawtool.h"
-#define TRANS_INFO_SIZE 10
-
typedef enum
{
TRANSFORM_CREATING,
@@ -36,10 +34,26 @@ typedef enum
TRANSFORM_HANDLE_S, /* south */
TRANSFORM_HANDLE_E, /* east */
TRANSFORM_HANDLE_W, /* west */
- TRANSFORM_HANDLE_PIVOT, /* pivot for rotation and scaling */
- TRANSFORM_HANDLE_CENTER /* for moving */
+ TRANSFORM_HANDLE_PIVOT, /* pivot for rotation and scaling */
+ TRANSFORM_HANDLE_CENTER, /* for moving */
+ /* extra handles for unified tool */
+ TRANSFORM_HANDLE_NW_P, /* perspective handles */
+ TRANSFORM_HANDLE_NE_P,
+ TRANSFORM_HANDLE_SW_P,
+ TRANSFORM_HANDLE_SE_P,
+ TRANSFORM_HANDLE_N_S, /* shearing handles */
+ TRANSFORM_HANDLE_S_S,
+ TRANSFORM_HANDLE_E_S,
+ TRANSFORM_HANDLE_W_S,
+ TRANSFORM_HANDLE_ROTATION, /* rotation handle */
+
+ TRANSFORM_HANDLE_NUM /* keep this last so *handles[] is the right size */
} TransformAction;
+/* This is not the number of items in the enum above, but the max size of the
+ * enums at the top of each transformation tool, stored in trans_info and related */
+#define TRANS_INFO_SIZE 10
+
typedef gdouble TransInfo[TRANS_INFO_SIZE];
@@ -74,7 +88,7 @@ struct _GimpTransformTool
gint x1, y1; /* upper left hand coordinate */
gint x2, y2; /* lower right hand coords */
gdouble cx, cy; /* center point (for moving) */
- gdouble px, py; /* pivot point (for rotation) */
+ gdouble px, py; /* pivot point (for rotation/scaling)*/
gdouble aspect; /* original aspect ratio */
gdouble tx1, ty1; /* transformed handle coords */
@@ -102,7 +116,7 @@ struct _GimpTransformTool
gboolean use_mid_handles; /* use handles at midpoints of edges */
gboolean use_pivot; /* use pivot point */
- GimpCanvasItem *handles[TRANSFORM_HANDLE_CENTER + 1];
+ GimpCanvasItem *handles[TRANSFORM_HANDLE_NUM];
const gchar *progress_text;
diff --git a/app/tools/gimpunifiedtransformationtool.c b/app/tools/gimpunifiedtransformationtool.c
index 74623e4..c93a0b8 100644
--- a/app/tools/gimpunifiedtransformationtool.c
+++ b/app/tools/gimpunifiedtransformationtool.c
@@ -95,7 +95,7 @@ gimp_unified_transformation_tool_register (GimpToolRegisterCallback callback,
_("Unified Transformation"),
_("Unified Transformation Tool: "
"Transform the layer, selection or path"),
- N_("_Unified Transformation"), "<shift>U",
+ N_("_Unified Transformation"), "<shift>L",
NULL, GIMP_HELP_TOOL_UNIFIED_TRANSFORMATION,
GIMP_STOCK_TOOL_UNIFIED_TRANSFORMATION,
data);
@@ -179,9 +179,10 @@ gimp_unified_transformation_tool_draw (GimpDrawTool *draw_tool)
GimpTransformTool *tr_tool = GIMP_TRANSFORM_TOOL (draw_tool);
GimpTransformOptions *options = GIMP_TRANSFORM_TOOL_GET_OPTIONS (tool);
GimpImage *image = gimp_display_get_image (tool->display);
- gint handle_w;
- gint handle_h;
- gint i;
+ GimpCanvasGroup *stroke_group;
+ gint handle_w, handle_h;
+ gint i, d;
+ gdouble x, y;
for (i = 0; i < G_N_ELEMENTS (tr_tool->handles); i++)
tr_tool->handles[i] = NULL;
@@ -215,6 +216,7 @@ gimp_unified_transformation_tool_draw (GimpDrawTool *draw_tool)
&handle_w, &handle_h);
/* draw an item at 40,80 in screen coordinates */
+ /*
gint x, y;
gimp_display_shell_untransform_xy (gimp_display_get_shell (tool->display),
40, 80, &x, &y, TRUE);
@@ -223,134 +225,205 @@ gimp_unified_transformation_tool_draw (GimpDrawTool *draw_tool)
x, y,
5, 5,
GIMP_HANDLE_ANCHOR_CENTER);
+ */
+
+ /* draw the scale handles */
+ tr_tool->handles[TRANSFORM_HANDLE_NW] =
+ gimp_draw_tool_add_handle (draw_tool,
+ GIMP_HANDLE_SQUARE,
+ tr_tool->tx1, tr_tool->ty1,
+ handle_w, handle_h,
+ GIMP_HANDLE_ANCHOR_NORTH_WEST);
+
+ tr_tool->handles[TRANSFORM_HANDLE_NE] =
+ gimp_draw_tool_add_handle (draw_tool,
+ GIMP_HANDLE_SQUARE,
+ tr_tool->tx2, tr_tool->ty2,
+ handle_w, handle_h,
+ GIMP_HANDLE_ANCHOR_NORTH_EAST);
+
+ tr_tool->handles[TRANSFORM_HANDLE_SW] =
+ gimp_draw_tool_add_handle (draw_tool,
+ GIMP_HANDLE_SQUARE,
+ tr_tool->tx3, tr_tool->ty3,
+ handle_w, handle_h,
+ GIMP_HANDLE_ANCHOR_SOUTH_WEST);
+
+ tr_tool->handles[TRANSFORM_HANDLE_SE] =
+ gimp_draw_tool_add_handle (draw_tool,
+ GIMP_HANDLE_SQUARE,
+ tr_tool->tx4, tr_tool->ty4,
+ handle_w, handle_h,
+ GIMP_HANDLE_ANCHOR_SOUTH_EAST);
+
+ /* draw the perspective handles */
+ tr_tool->handles[TRANSFORM_HANDLE_NW_P] =
+ gimp_draw_tool_add_handle (draw_tool,
+ GIMP_HANDLE_FUNNY_PERSPECTIVE_THING_GUIGURU_CAME_UP_WITH,
+ tr_tool->tx1 + handle_w/4, tr_tool->ty1 + handle_h/4,
+ handle_w/4*3, handle_h/4*3,
+ GIMP_HANDLE_ANCHOR_NORTH_WEST);
+
+ tr_tool->handles[TRANSFORM_HANDLE_NE_P] =
+ gimp_draw_tool_add_handle (draw_tool,
+ GIMP_HANDLE_FUNNY_PERSPECTIVE_THING_GUIGURU_CAME_UP_WITH,
+ tr_tool->tx2 - handle_w/4, tr_tool->ty2 + handle_h/4,
+ handle_w/4*3, handle_h/4*3,
+ GIMP_HANDLE_ANCHOR_NORTH_EAST);
+
+ tr_tool->handles[TRANSFORM_HANDLE_SW_P] =
+ gimp_draw_tool_add_handle (draw_tool,
+ GIMP_HANDLE_FUNNY_PERSPECTIVE_THING_GUIGURU_CAME_UP_WITH,
+ tr_tool->tx3 + handle_w/4, tr_tool->ty3 - handle_h/4,
+ handle_w/4*3, handle_h/4*3,
+ GIMP_HANDLE_ANCHOR_SOUTH_WEST);
+
+ tr_tool->handles[TRANSFORM_HANDLE_SE_P] =
+ gimp_draw_tool_add_handle (draw_tool,
+ GIMP_HANDLE_FUNNY_PERSPECTIVE_THING_GUIGURU_CAME_UP_WITH,
+ tr_tool->tx4 - handle_w/4, tr_tool->ty4 - handle_h/4,
+ handle_w/4*3, handle_h/4*3,
+ GIMP_HANDLE_ANCHOR_SOUTH_EAST);
+
+ /* draw the side handles */
+ x = (tr_tool->tx1 + tr_tool->tx2) / 2.0;
+ y = (tr_tool->ty1 + tr_tool->ty2) / 2.0;
+
+ tr_tool->handles[TRANSFORM_HANDLE_N] =
+ gimp_draw_tool_add_handle (draw_tool,
+ GIMP_HANDLE_SQUARE,
+ x, y,
+ handle_w, handle_h,
+ GIMP_HANDLE_ANCHOR_CENTER);
+
+ x = (tr_tool->tx2 + tr_tool->tx4) / 2.0;
+ y = (tr_tool->ty2 + tr_tool->ty4) / 2.0;
+
+ tr_tool->handles[TRANSFORM_HANDLE_E] =
+ gimp_draw_tool_add_handle (draw_tool,
+ GIMP_HANDLE_SQUARE,
+ x, y,
+ handle_w, handle_h,
+ GIMP_HANDLE_ANCHOR_CENTER);
+
+ x = (tr_tool->tx3 + tr_tool->tx4) / 2.0;
+ y = (tr_tool->ty3 + tr_tool->ty4) / 2.0;
+
+ tr_tool->handles[TRANSFORM_HANDLE_S] =
+ gimp_draw_tool_add_handle (draw_tool,
+ GIMP_HANDLE_SQUARE,
+ x, y,
+ handle_w, handle_h,
+ GIMP_HANDLE_ANCHOR_CENTER);
+
+ x = (tr_tool->tx3 + tr_tool->tx1) / 2.0;
+ y = (tr_tool->ty3 + tr_tool->ty1) / 2.0;
+
+ tr_tool->handles[TRANSFORM_HANDLE_W] =
+ gimp_draw_tool_add_handle (draw_tool,
+ GIMP_HANDLE_SQUARE,
+ x, y,
+ handle_w, handle_h,
+ GIMP_HANDLE_ANCHOR_CENTER);
+
+ /* draw the shear handles */
+ /*the math here is a bit wrong but it'll do for now*/
+ x = (tr_tool->tx1 * 2 + tr_tool->tx2 * 3) / 5;
+ y = (tr_tool->ty1 * 2 + tr_tool->ty2 * 3) / 5;
+
+ tr_tool->handles[TRANSFORM_HANDLE_N_S] =
+ gimp_draw_tool_add_handle (draw_tool,
+ GIMP_HANDLE_FILLED_DIAMOND,
+ x, y,
+ handle_w, handle_h,
+ GIMP_HANDLE_ANCHOR_CENTER);
+
+ x = (tr_tool->tx2 * 2 + tr_tool->tx4 * 3) / 5;
+ y = (tr_tool->ty2 * 2 + tr_tool->ty4 * 3) / 5;
+
+ tr_tool->handles[TRANSFORM_HANDLE_E_S] =
+ gimp_draw_tool_add_handle (draw_tool,
+ GIMP_HANDLE_FILLED_DIAMOND,
+ x, y,
+ handle_w, handle_h,
+ GIMP_HANDLE_ANCHOR_CENTER);
+
+ x = (tr_tool->tx3 * 3 + tr_tool->tx4 * 2) / 5;
+ y = (tr_tool->ty3 * 3 + tr_tool->ty4 * 2) / 5;
+
+ tr_tool->handles[TRANSFORM_HANDLE_S_S] =
+ gimp_draw_tool_add_handle (draw_tool,
+ GIMP_HANDLE_FILLED_DIAMOND,
+ x, y,
+ handle_w, handle_h,
+ GIMP_HANDLE_ANCHOR_CENTER);
+
+ x = (tr_tool->tx3 * 3 + tr_tool->tx1 * 2) / 5;
+ y = (tr_tool->ty3 * 3 + tr_tool->ty1 * 2) / 5;
+
+ tr_tool->handles[TRANSFORM_HANDLE_W_S] =
+ gimp_draw_tool_add_handle (draw_tool,
+ GIMP_HANDLE_FILLED_DIAMOND,
+ x, y,
+ handle_w, handle_h,
+ GIMP_HANDLE_ANCHOR_CENTER);
+
+
+ /* draw the rotation handle */
+ x = (tr_tool->tx1 * 3 + tr_tool->tx2 * 2) / 5;
+ y = (tr_tool->ty1 * 3 + tr_tool->ty2 * 2) / 5;
+
+ tr_tool->handles[TRANSFORM_HANDLE_ROTATION] =
+ gimp_draw_tool_add_handle (draw_tool,
+ GIMP_HANDLE_FILLED_CIRCLE,
+ x, y,
+ handle_w, handle_h,
+ GIMP_HANDLE_ANCHOR_CENTER);
+
+
+ /* draw the rotation center axis handle */
+ d = MIN (handle_w, handle_h) * 2; /* so you can grab it from under the center handle */
+
+ stroke_group = gimp_draw_tool_add_stroke_group (draw_tool);
+
+ tr_tool->handles[TRANSFORM_HANDLE_PIVOT] = GIMP_CANVAS_ITEM (stroke_group);
+
+ gimp_draw_tool_push_group (draw_tool, stroke_group);
- if (tr_tool->use_handles)
- {
- /* draw the tool handles */
- tr_tool->handles[TRANSFORM_HANDLE_NW] =
- gimp_draw_tool_add_handle (draw_tool,
- GIMP_HANDLE_SQUARE,
- tr_tool->tx1, tr_tool->ty1,
- handle_w, handle_h,
- GIMP_HANDLE_ANCHOR_CENTER);
-
- tr_tool->handles[TRANSFORM_HANDLE_NE] =
- gimp_draw_tool_add_handle (draw_tool,
- GIMP_HANDLE_SQUARE,
- tr_tool->tx2, tr_tool->ty2,
- handle_w, handle_h,
- GIMP_HANDLE_ANCHOR_CENTER);
-
- tr_tool->handles[TRANSFORM_HANDLE_SW] =
- gimp_draw_tool_add_handle (draw_tool,
- GIMP_HANDLE_SQUARE,
- tr_tool->tx3, tr_tool->ty3,
- handle_w, handle_h,
- GIMP_HANDLE_ANCHOR_CENTER);
-
- tr_tool->handles[TRANSFORM_HANDLE_SE] =
- gimp_draw_tool_add_handle (draw_tool,
- GIMP_HANDLE_SQUARE,
- tr_tool->tx4, tr_tool->ty4,
- handle_w, handle_h,
- GIMP_HANDLE_ANCHOR_CENTER);
-
- if (tr_tool->use_mid_handles)
- {
- gdouble x, y;
-
- x = (tr_tool->tx1 + tr_tool->tx2) / 2.0;
- y = (tr_tool->ty1 + tr_tool->ty2) / 2.0;
-
- tr_tool->handles[TRANSFORM_HANDLE_N] =
- gimp_draw_tool_add_handle (draw_tool,
- GIMP_HANDLE_SQUARE,
- x, y,
- handle_w, handle_h,
- GIMP_HANDLE_ANCHOR_CENTER);
-
- x = (tr_tool->tx2 + tr_tool->tx4) / 2.0;
- y = (tr_tool->ty2 + tr_tool->ty4) / 2.0;
-
- tr_tool->handles[TRANSFORM_HANDLE_E] =
- gimp_draw_tool_add_handle (draw_tool,
- GIMP_HANDLE_SQUARE,
- x, y,
- handle_w, handle_h,
- GIMP_HANDLE_ANCHOR_CENTER);
-
- x = (tr_tool->tx3 + tr_tool->tx4) / 2.0;
- y = (tr_tool->ty3 + tr_tool->ty4) / 2.0;
-
- tr_tool->handles[TRANSFORM_HANDLE_S] =
- gimp_draw_tool_add_handle (draw_tool,
- GIMP_HANDLE_SQUARE,
- x, y,
- handle_w, handle_h,
- GIMP_HANDLE_ANCHOR_CENTER);
-
- x = (tr_tool->tx3 + tr_tool->tx1) / 2.0;
- y = (tr_tool->ty3 + tr_tool->ty1) / 2.0;
-
- tr_tool->handles[TRANSFORM_HANDLE_W] =
- gimp_draw_tool_add_handle (draw_tool,
- GIMP_HANDLE_SQUARE,
- x, y,
- handle_w, handle_h,
- GIMP_HANDLE_ANCHOR_CENTER);
- }
- }
-
- if (tr_tool->use_pivot)
- {
- GimpCanvasGroup *stroke_group;
- gint d = MIN (handle_w, handle_h) * 2; /* so you can grab it from under the center handle */
-
- stroke_group = gimp_draw_tool_add_stroke_group (draw_tool);
-
- tr_tool->handles[TRANSFORM_HANDLE_PIVOT] = GIMP_CANVAS_ITEM (stroke_group);
-
- gimp_draw_tool_push_group (draw_tool, stroke_group);
+ gimp_draw_tool_add_handle (draw_tool,
+ GIMP_HANDLE_SQUARE,
+ tr_tool->tpx, tr_tool->tpy,
+ d, d,
+ GIMP_HANDLE_ANCHOR_CENTER);
+ gimp_draw_tool_add_handle (draw_tool,
+ GIMP_HANDLE_CROSS,
+ tr_tool->tpx, tr_tool->tpy,
+ d, d,
+ GIMP_HANDLE_ANCHOR_CENTER);
- gimp_draw_tool_add_handle (draw_tool,
- GIMP_HANDLE_SQUARE,
- tr_tool->tpx, tr_tool->tpy,
- d, d,
- GIMP_HANDLE_ANCHOR_CENTER);
- gimp_draw_tool_add_handle (draw_tool,
- GIMP_HANDLE_CROSS,
- tr_tool->tpx, tr_tool->tpy,
- d, d,
- GIMP_HANDLE_ANCHOR_CENTER);
+ gimp_draw_tool_pop_group (draw_tool);
- gimp_draw_tool_pop_group (draw_tool);
- }
+ /* draw the move handle */
+ d = MIN (handle_w, handle_h);
- /* draw the center */
- if (tr_tool->use_center)
- {
- GimpCanvasGroup *stroke_group;
- gint d = MIN (handle_w, handle_h);
+ stroke_group = gimp_draw_tool_add_stroke_group (draw_tool);
- stroke_group = gimp_draw_tool_add_stroke_group (draw_tool);
+ tr_tool->handles[TRANSFORM_HANDLE_CENTER] = GIMP_CANVAS_ITEM (stroke_group);
- tr_tool->handles[TRANSFORM_HANDLE_CENTER] = GIMP_CANVAS_ITEM (stroke_group);
+ gimp_draw_tool_push_group (draw_tool, stroke_group);
- gimp_draw_tool_push_group (draw_tool, stroke_group);
-
- gimp_draw_tool_add_handle (draw_tool,
- GIMP_HANDLE_CIRCLE,
- tr_tool->tcx, tr_tool->tcy,
- d, d,
- GIMP_HANDLE_ANCHOR_CENTER);
- gimp_draw_tool_add_handle (draw_tool,
- GIMP_HANDLE_CROSS,
- tr_tool->tcx, tr_tool->tcy,
- d, d,
- GIMP_HANDLE_ANCHOR_CENTER);
+ gimp_draw_tool_add_handle (draw_tool,
+ GIMP_HANDLE_CIRCLE,
+ tr_tool->tcx, tr_tool->tcy,
+ d, d,
+ GIMP_HANDLE_ANCHOR_CENTER);
+ gimp_draw_tool_add_handle (draw_tool,
+ GIMP_HANDLE_CROSS,
+ tr_tool->tcx, tr_tool->tcy,
+ d, d,
+ GIMP_HANDLE_ANCHOR_CENTER);
- gimp_draw_tool_pop_group (draw_tool);
- }
+ gimp_draw_tool_pop_group (draw_tool);
if (tr_tool->handles[tr_tool->function])
{
@@ -358,6 +431,7 @@ gimp_unified_transformation_tool_draw (GimpDrawTool *draw_tool)
TRUE);
}
+ /* the rest of the function is the same as in the parent class */
if (options->type == GIMP_TRANSFORM_TYPE_SELECTION)
{
GimpMatrix3 matrix = tr_tool->transform;
@@ -715,6 +789,9 @@ gimp_unified_transformation_tool_motion (GimpTransformTool *transform_tool)
return;
}
case TRANSFORM_HANDLE_CENTER:
+ if (options->constrain) {
+ diff_y = diff_x;
+ }
*x[0] += diff_x;
*y[0] += diff_y;
*x[1] += diff_x;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]