Commit f901b46d authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

restructured the new draw utility functions and added

2001-11-15  Michael Natterer  <mitch@gimp.org>

	* app/tools/gimpdrawtool.[ch]: restructured the new draw utility
	functions and added gimp_draw_tool_draw_handle() and
	gimp_draw_tool_on_handle().

	* app/tools/gimpbezierselecttool.c
	* app/tools/gimpblendtool.c
	* app/tools/gimpcroptool.[ch]
	* app/tools/gimpiscissorstool.c
	* app/tools/gimpmeasuretool.c
	* app/tools/gimppainttool.c
	* app/tools/gimppathtool.c
	* app/tools/gimptransformtool.c: use the new functions all over
	the place so handle drawing and mouse_over detection work the same
	for all tools.
parent 2377f709
2001-11-15 Michael Natterer <mitch@gimp.org>
* app/tools/gimpdrawtool.[ch]: restructured the new draw utility
functions and added gimp_draw_tool_draw_handle() and
gimp_draw_tool_on_handle().
* app/tools/gimpbezierselecttool.c
* app/tools/gimpblendtool.c
* app/tools/gimpcroptool.[ch]
* app/tools/gimpiscissorstool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimppainttool.c
* app/tools/gimppathtool.c
* app/tools/gimptransformtool.c: use the new functions all over
the place so handle drawing and mouse_over detection work the same
for all tools.
2001-11-15 Michael Natterer <mitch@gimp.org>
* Makefile.am: removed antique Makefile targets, including the
......
......@@ -429,10 +429,13 @@ gimp_transform_tool_button_press (GimpTool *tool,
gt_tool->function = TRANSFORM_HANDLE_4;
}
if (gimp_draw_tool_in_radius (draw_tool, gdisp,
if (gimp_draw_tool_on_handle (draw_tool, gdisp,
coords->x, coords->y,
GIMP_HANDLE_CIRCLE,
gt_tool->tcx, gt_tool->tcy,
HANDLE >> 1))
HANDLE, HANDLE,
GIMP_HANDLE_CIRCLE,
FALSE))
{
gt_tool->function = TRANSFORM_HANDLE_CENTER;
}
......@@ -859,29 +862,38 @@ gimp_transform_tool_draw (GimpDrawTool *draw_tool)
}
/* draw the tool handles */
gimp_draw_tool_draw_rectangle_by_center (draw_tool, FALSE,
tr_tool->tx1, tr_tool->ty1,
HANDLE, HANDLE,
FALSE);
gimp_draw_tool_draw_rectangle_by_center (draw_tool, FALSE,
tr_tool->tx2, tr_tool->ty2,
HANDLE, HANDLE,
FALSE);
gimp_draw_tool_draw_rectangle_by_center (draw_tool, FALSE,
tr_tool->tx3, tr_tool->ty3,
HANDLE, HANDLE,
FALSE);
gimp_draw_tool_draw_rectangle_by_center (draw_tool, FALSE,
tr_tool->tx4, tr_tool->ty4,
HANDLE, HANDLE,
FALSE);
gimp_draw_tool_draw_handle (draw_tool,
GIMP_HANDLE_SQUARE,
tr_tool->tx1, tr_tool->ty1,
HANDLE, HANDLE,
GTK_ANCHOR_CENTER,
FALSE);
gimp_draw_tool_draw_handle (draw_tool,
GIMP_HANDLE_SQUARE,
tr_tool->tx2, tr_tool->ty2,
HANDLE, HANDLE,
GTK_ANCHOR_CENTER,
FALSE);
gimp_draw_tool_draw_handle (draw_tool,
GIMP_HANDLE_SQUARE,
tr_tool->tx3, tr_tool->ty3,
HANDLE, HANDLE,
GTK_ANCHOR_CENTER,
FALSE);
gimp_draw_tool_draw_handle (draw_tool,
GIMP_HANDLE_SQUARE,
tr_tool->tx4, tr_tool->ty4,
HANDLE, HANDLE,
GTK_ANCHOR_CENTER,
FALSE);
/* draw the center */
gimp_draw_tool_draw_arc_by_center (draw_tool, TRUE,
tr_tool->tcx, tr_tool->tcy,
HANDLE >> 1,
0, 23040,
FALSE);
gimp_draw_tool_draw_handle (draw_tool,
GIMP_HANDLE_FILLED_CIRCLE,
tr_tool->tcx, tr_tool->tcy,
HANDLE, HANDLE,
GTK_ANCHOR_CENTER,
FALSE);
if (gimp_transform_tool_showpath ())
{
......
......@@ -429,10 +429,13 @@ gimp_transform_tool_button_press (GimpTool *tool,
gt_tool->function = TRANSFORM_HANDLE_4;
}
if (gimp_draw_tool_in_radius (draw_tool, gdisp,
if (gimp_draw_tool_on_handle (draw_tool, gdisp,
coords->x, coords->y,
GIMP_HANDLE_CIRCLE,
gt_tool->tcx, gt_tool->tcy,
HANDLE >> 1))
HANDLE, HANDLE,
GIMP_HANDLE_CIRCLE,
FALSE))
{
gt_tool->function = TRANSFORM_HANDLE_CENTER;
}
......@@ -859,29 +862,38 @@ gimp_transform_tool_draw (GimpDrawTool *draw_tool)
}
/* draw the tool handles */
gimp_draw_tool_draw_rectangle_by_center (draw_tool, FALSE,
tr_tool->tx1, tr_tool->ty1,
HANDLE, HANDLE,
FALSE);
gimp_draw_tool_draw_rectangle_by_center (draw_tool, FALSE,
tr_tool->tx2, tr_tool->ty2,
HANDLE, HANDLE,
FALSE);
gimp_draw_tool_draw_rectangle_by_center (draw_tool, FALSE,
tr_tool->tx3, tr_tool->ty3,
HANDLE, HANDLE,
FALSE);
gimp_draw_tool_draw_rectangle_by_center (draw_tool, FALSE,
tr_tool->tx4, tr_tool->ty4,
HANDLE, HANDLE,
FALSE);
gimp_draw_tool_draw_handle (draw_tool,
GIMP_HANDLE_SQUARE,
tr_tool->tx1, tr_tool->ty1,
HANDLE, HANDLE,
GTK_ANCHOR_CENTER,
FALSE);
gimp_draw_tool_draw_handle (draw_tool,
GIMP_HANDLE_SQUARE,
tr_tool->tx2, tr_tool->ty2,
HANDLE, HANDLE,
GTK_ANCHOR_CENTER,
FALSE);
gimp_draw_tool_draw_handle (draw_tool,
GIMP_HANDLE_SQUARE,
tr_tool->tx3, tr_tool->ty3,
HANDLE, HANDLE,
GTK_ANCHOR_CENTER,
FALSE);
gimp_draw_tool_draw_handle (draw_tool,
GIMP_HANDLE_SQUARE,
tr_tool->tx4, tr_tool->ty4,
HANDLE, HANDLE,
GTK_ANCHOR_CENTER,
FALSE);
/* draw the center */
gimp_draw_tool_draw_arc_by_center (draw_tool, TRUE,
tr_tool->tcx, tr_tool->tcy,
HANDLE >> 1,
0, 23040,
FALSE);
gimp_draw_tool_draw_handle (draw_tool,
GIMP_HANDLE_FILLED_CIRCLE,
tr_tool->tcx, tr_tool->tcy,
HANDLE, HANDLE,
GTK_ANCHOR_CENTER,
FALSE);
if (gimp_transform_tool_showpath ())
{
......
......@@ -788,18 +788,24 @@ gimp_paint_tool_draw (GimpDrawTool *draw_tool)
paint_tool = GIMP_PAINT_TOOL (draw_tool);
/* Draw start target */
gimp_draw_tool_draw_cross (draw_tool,
floor (paint_tool->last_coords.x) + 0.5,
floor (paint_tool->last_coords.y) + 0.5,
TARGET_SIZE,
TRUE);
gimp_draw_tool_draw_handle (draw_tool,
GIMP_HANDLE_CROSS,
floor (paint_tool->last_coords.x) + 0.5,
floor (paint_tool->last_coords.y) + 0.5,
TARGET_SIZE,
TARGET_SIZE,
GTK_ANCHOR_CENTER,
TRUE);
/* Draw end target */
gimp_draw_tool_draw_cross (draw_tool,
floor (paint_tool->cur_coords.x) + 0.5,
floor (paint_tool->cur_coords.y) + 0.5,
TARGET_SIZE,
TRUE);
gimp_draw_tool_draw_handle (draw_tool,
GIMP_HANDLE_CROSS,
floor (paint_tool->cur_coords.x) + 0.5,
floor (paint_tool->cur_coords.y) + 0.5,
TARGET_SIZE,
TARGET_SIZE,
GTK_ANCHOR_CENTER,
TRUE);
/* Draw the line between the start and end coords */
gimp_draw_tool_draw_line (draw_tool,
......
......@@ -1869,7 +1869,8 @@ gimp_bezier_select_tool_cursor_update (GimpTool *tool,
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
if (gdisp != tool->gdisp || draw_tool->draw_state == INVISIBLE)
if (gdisp != tool->gdisp ||
draw_tool->draw_state == GIMP_DRAW_TOOL_STATE_INVISIBLE)
{
gimp_display_shell_install_tool_cursor (shell,
GIMP_MOUSE_CURSOR,
......
......@@ -498,18 +498,24 @@ gimp_blend_tool_draw (GimpDrawTool *draw_tool)
blend_tool = GIMP_BLEND_TOOL (draw_tool);
/* Draw start target */
gimp_draw_tool_draw_cross (draw_tool,
floor (blend_tool->startx) + 0.5,
floor (blend_tool->starty) + 0.5,
TARGET_SIZE,
TRUE);
gimp_draw_tool_draw_handle (draw_tool,
GIMP_HANDLE_CROSS,
floor (blend_tool->startx) + 0.5,
floor (blend_tool->starty) + 0.5,
TARGET_SIZE,
TARGET_SIZE,
GTK_ANCHOR_CENTER,
TRUE);
/* Draw end target */
gimp_draw_tool_draw_cross (draw_tool,
floor (blend_tool->endx) + 0.5,
floor (blend_tool->endy) + 0.5,
TARGET_SIZE,
TRUE);
gimp_draw_tool_draw_handle (draw_tool,
GIMP_HANDLE_CROSS,
floor (blend_tool->endx) + 0.5,
floor (blend_tool->endy) + 0.5,
TARGET_SIZE,
TARGET_SIZE,
GTK_ANCHOR_CENTER,
TRUE);
/* Draw the line between the start and end coords */
gimp_draw_tool_draw_line (draw_tool,
......
......@@ -788,18 +788,24 @@ gimp_paint_tool_draw (GimpDrawTool *draw_tool)
paint_tool = GIMP_PAINT_TOOL (draw_tool);
/* Draw start target */
gimp_draw_tool_draw_cross (draw_tool,
floor (paint_tool->last_coords.x) + 0.5,
floor (paint_tool->last_coords.y) + 0.5,
TARGET_SIZE,
TRUE);
gimp_draw_tool_draw_handle (draw_tool,
GIMP_HANDLE_CROSS,
floor (paint_tool->last_coords.x) + 0.5,
floor (paint_tool->last_coords.y) + 0.5,
TARGET_SIZE,
TARGET_SIZE,
GTK_ANCHOR_CENTER,
TRUE);
/* Draw end target */
gimp_draw_tool_draw_cross (draw_tool,
floor (paint_tool->cur_coords.x) + 0.5,
floor (paint_tool->cur_coords.y) + 0.5,
TARGET_SIZE,
TRUE);
gimp_draw_tool_draw_handle (draw_tool,
GIMP_HANDLE_CROSS,
floor (paint_tool->cur_coords.x) + 0.5,
floor (paint_tool->cur_coords.y) + 0.5,
TARGET_SIZE,
TARGET_SIZE,
GTK_ANCHOR_CENTER,
TRUE);
/* Draw the line between the start and end coords */
gimp_draw_tool_draw_line (draw_tool,
......
......@@ -314,9 +314,11 @@ gimp_crop_tool_button_press (GimpTool *tool,
GimpDisplay *gdisp)
{
GimpCropTool *crop;
GimpDrawTool *draw_tool;
GimpDisplayShell *shell;
crop = GIMP_CROP_TOOL (tool);
crop = GIMP_CROP_TOOL (tool);
draw_tool = GIMP_DRAW_TOOL (tool);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
......@@ -329,27 +331,43 @@ gimp_crop_tool_button_press (GimpTool *tool,
/* If the cursor is in either the upper left or lower right boxes,
* The new function will be to resize the current crop area
*/
if (coords->x == CLAMP (coords->x, crop->x1, crop->x1 + crop->cw) &&
coords->y == CLAMP (coords->y, crop->y1, crop->y1 + crop->ch))
if (gimp_draw_tool_on_handle (draw_tool, gdisp,
coords->x, coords->y,
GIMP_HANDLE_SQUARE,
crop->x1, crop->y1,
crop->dcw, crop->dch,
GTK_ANCHOR_NORTH_WEST,
FALSE))
{
crop->function = RESIZING_LEFT;
}
else if (coords->x == CLAMP (coords->x, crop->x2 - crop->cw, crop->x2) &&
coords->y == CLAMP (coords->y, crop->y2 - crop->ch, crop->y2))
else if (gimp_draw_tool_on_handle (draw_tool, gdisp,
coords->x, coords->y,
GIMP_HANDLE_SQUARE,
crop->x2, crop->y2,
crop->dcw, crop->dch,
GTK_ANCHOR_SOUTH_EAST,
FALSE))
{
crop->function = RESIZING_RIGHT;
}
/* If the cursor is in either the upper right or lower left boxes,
* The new function will be to translate the current crop area
*/
else if ((coords->x == CLAMP (coords->x,
crop->x1, crop->x1 + crop->cw) &&
coords->y == CLAMP (coords->y,
crop->y2 - crop->ch, crop->y2)) ||
(coords->x == CLAMP (coords->x,
crop->x2 - crop->cw, crop->x2) &&
coords->y == CLAMP (coords->y,
crop->y1, crop->y1 + crop->ch)))
else if (gimp_draw_tool_on_handle (draw_tool, gdisp,
coords->x, coords->y,
GIMP_HANDLE_SQUARE,
crop->x2, crop->y1,
crop->dcw, crop->dch,
GTK_ANCHOR_NORTH_EAST,
FALSE) ||
gimp_draw_tool_on_handle (draw_tool, gdisp,
coords->x, coords->y,
GIMP_HANDLE_SQUARE,
crop->x1, crop->y2,
crop->dcw, crop->dch,
GTK_ANCHOR_SOUTH_WEST,
FALSE))
{
crop->function = MOVING;
}
......@@ -726,11 +744,13 @@ gimp_crop_tool_cursor_update (GimpTool *tool,
GimpDisplay *gdisp)
{
GimpCropTool *crop;
GimpDrawTool *draw_tool;
GimpDisplayShell *shell;
GdkCursorType ctype = GIMP_MOUSE_CURSOR;
GimpCursorModifier cmodifier = GIMP_CURSOR_MODIFIER_NONE;
crop = GIMP_CROP_TOOL (tool);
crop = GIMP_CROP_TOOL (tool);
draw_tool = GIMP_DRAW_TOOL (tool);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
......@@ -739,23 +759,37 @@ gimp_crop_tool_cursor_update (GimpTool *tool,
{
ctype = GIMP_CROSSHAIR_SMALL_CURSOR;
}
else if (coords->x == CLAMP (coords->x, crop->x1, crop->x1 + crop->cw) &&
coords->y == CLAMP (coords->y, crop->y1, crop->y1 + crop->ch))
{
cmodifier = GIMP_CURSOR_MODIFIER_RESIZE;
}
else if (coords->x == CLAMP (coords->x, crop->x2 - crop->cw, crop->x2) &&
coords->y == CLAMP (coords->y, crop->y2 - crop->ch, crop->y2))
else if (gimp_draw_tool_on_handle (draw_tool, gdisp,
coords->x, coords->y,
GIMP_HANDLE_SQUARE,
crop->x1, crop->y1,
crop->dcw, crop->dch,
GTK_ANCHOR_NORTH_WEST,
FALSE) ||
gimp_draw_tool_on_handle (draw_tool, gdisp,
coords->x, coords->y,
GIMP_HANDLE_SQUARE,
crop->x2, crop->y2,
crop->dcw, crop->dch,
GTK_ANCHOR_SOUTH_EAST,
FALSE))
{
cmodifier = GIMP_CURSOR_MODIFIER_RESIZE;
}
else if (coords->x == CLAMP (coords->x, crop->x1, crop->x1 + crop->cw) &&
coords->y == CLAMP (coords->y, crop->y2 - crop->ch, crop->y2))
{
cmodifier = GIMP_CURSOR_MODIFIER_MOVE;
}
else if (coords->x == CLAMP (coords->x, crop->x2 - crop->cw, crop->x2) &&
coords->y == CLAMP (coords->y, crop->y1, crop->y1 + crop->ch))
else if (gimp_draw_tool_on_handle (draw_tool, gdisp,
coords->x, coords->y,
GIMP_HANDLE_SQUARE,
crop->x2, crop->y1,
crop->dcw, crop->dch,
GTK_ANCHOR_NORTH_EAST,
FALSE) ||
gimp_draw_tool_on_handle (draw_tool, gdisp,
coords->x, coords->y,
GIMP_HANDLE_SQUARE,
crop->x1, crop->y2,
crop->dcw, crop->dch,
GTK_ANCHOR_SOUTH_WEST,
FALSE))
{
cmodifier = GIMP_CURSOR_MODIFIER_MOVE;
}
......@@ -798,18 +832,30 @@ gimp_crop_tool_draw (GimpDrawTool *draw)
crop->dx2, crop->dy2,
crop->dx2, 0);
gdk_draw_rectangle (draw->win, draw->gc, TRUE,
crop->dx1, crop->dy1,
crop->dcw, crop->dch);
gdk_draw_rectangle (draw->win, draw->gc, TRUE,
crop->dx2 - crop->dcw, crop->dy2-crop->dch,
crop->dcw, crop->dch);
gdk_draw_rectangle (draw->win, draw->gc, TRUE,
crop->dx2 - crop->dcw, crop->dy1,
crop->dcw, crop->dch);
gdk_draw_rectangle (draw->win, draw->gc, TRUE,
crop->dx1, crop->dy2-crop->dch,
crop->dcw, crop->dch);
gimp_draw_tool_draw_handle (draw,
GIMP_HANDLE_FILLED_SQUARE,
crop->x1, crop->y1,
crop->dcw, crop->dch,
GTK_ANCHOR_NORTH_WEST,
FALSE);
gimp_draw_tool_draw_handle (draw,
GIMP_HANDLE_FILLED_SQUARE,
crop->x2, crop->y1,
crop->dcw, crop->dch,
GTK_ANCHOR_NORTH_EAST,
FALSE);
gimp_draw_tool_draw_handle (draw,
GIMP_HANDLE_FILLED_SQUARE,
crop->x1, crop->y2,
crop->dcw, crop->dch,
GTK_ANCHOR_SOUTH_WEST,
FALSE);
gimp_draw_tool_draw_handle (draw,
GIMP_HANDLE_FILLED_SQUARE,
crop->x2, crop->y2,
crop->dcw, crop->dch,
GTK_ANCHOR_SOUTH_EAST,
FALSE);
crop_info_update (tool);
}
......@@ -851,9 +897,6 @@ crop_recalc (GimpTool *tool,
crop->dcw = ((crop->dx2 - crop->dx1) < SRW) ? (crop->dx2 - crop->dx1) : SRW;
crop->dch = ((crop->dy2 - crop->dy1) < SRH) ? (crop->dy2 - crop->dy1) : SRH;
crop->cw = UNSCALEX (tool->gdisp, crop->dcw);
crop->ch = UNSCALEY (tool->gdisp, crop->dch);
#undef SRW
#undef SRH
}
......
......@@ -54,13 +54,10 @@ struct _GimpCropTool
gint x1, y1; /* upper left hand coordinate */
gint x2, y2; /* lower right hand coords */
gint cw, ch; /* corners in image coords */
guint function; /* moving or resizing */
gint dx1, dy1; /* display coords */
gint dx2, dy2; /* */
gint dx2, dy2; /* */
gint dcw, dch; /* width and height of corners */
......
......@@ -36,14 +36,31 @@ enum
LAST_SIGNAL
};
static void gimp_draw_tool_class_init (GimpDrawToolClass *klass);
static void gimp_draw_tool_init (GimpDrawTool *draw_tool);
static void gimp_draw_tool_finalize (GObject *object);
static void gimp_draw_tool_control (GimpTool *tool,
ToolAction action,
GimpDisplay *gdisp);
static void gimp_draw_tool_class_init (GimpDrawToolClass *klass);
static void gimp_draw_tool_init (GimpDrawTool *draw_tool);
static void gimp_draw_tool_finalize (GObject *object);
static void gimp_draw_tool_control (GimpTool *tool,
ToolAction action,
GimpDisplay *gdisp);
static inline void gimp_draw_tool_shift_to_north_west
(gdouble x,
gdouble y,
gint handle_width,
gint handle_height,
GtkAnchorType anchor,
gdouble *shifted_x,
gdouble *shifted_y);
static inline void gimp_draw_tool_shift_to_center
(gdouble x,
gdouble y,
gint handle_width,
gint handle_height,
GtkAnchorType anchor,
gdouble *shifted_x,
gdouble *shifted_y);
static guint gimp_draw_tool_signals[LAST_SIGNAL] = { 0 };
......@@ -108,7 +125,7 @@ gimp_draw_tool_class_init (GimpDrawToolClass *klass)
static void
gimp_draw_tool_init (GimpDrawTool *draw_tool)
{
draw_tool->draw_state = INVISIBLE;
draw_tool->draw_state = GIMP_DRAW_TOOL_STATE_INVISIBLE;
draw_tool->win = NULL;
draw_tool->gc = NULL;
draw_tool->paused_count = 0;
......@@ -173,7 +190,7 @@ gimp_draw_tool_start (GimpDrawTool *draw_tool,
g_return_if_fail (GIMP_IS_DRAW_TOOL (draw_tool));
g_return_if_fail (GDK_IS_WINDOW (win));
if (draw_tool->draw_state != INVISIBLE)
if (draw_tool->draw_state != GIMP_DRAW_TOOL_STATE_INVISIBLE)
gimp_draw_tool_stop (draw_tool); /* this seems backwards ;) */
draw_tool->win = win;
......@@ -196,7 +213,7 @@ gimp_draw_tool_start (GimpDrawTool *draw_tool,
g_signal_emit (G_OBJECT (draw_tool), gimp_draw_tool_signals[DRAW], 0);
draw_tool->draw_state = VISIBLE;
draw_tool->draw_state = GIMP_DRAW_TOOL_STATE_VISIBLE;
}
void
......@@ -204,12 +221,12 @@ gimp_draw_tool_stop (GimpDrawTool *draw_tool)
{
g_return_if_fail (GIMP_IS_DRAW_TOOL (draw_tool));
if (draw_tool->draw_state == INVISIBLE)
if (draw_tool->draw_state == GIMP_DRAW_TOOL_STATE_INVISIBLE)
return;
g_signal_emit (G_OBJECT (draw_tool), gimp_draw_tool_signals[DRAW], 0);
draw_tool->draw_state = INVISIBLE;
draw_tool->draw_state = GIMP_DRAW_TOOL_STATE_INVISIBLE;
}
void
......@@ -217,7 +234,7 @@ gimp_draw_tool_pause (GimpDrawTool *draw_tool)
{
if (draw_tool->paused_count == 0)
{
draw_tool->draw_state = INVISIBLE;
draw_tool->draw_state = GIMP_DRAW_TOOL_STATE_INVISIBLE;
g_signal_emit (G_OBJECT (draw_tool), gimp_draw_tool_signals[DRAW], 0);
}
......@@ -235,7 +252,7 @@ gimp_draw_tool_resume (GimpDrawTool *draw_tool)
if (draw_tool->paused_count == 0)
{
draw_tool->draw_state = VISIBLE;
draw_tool->draw_state = GIMP_DRAW_TOOL_STATE_VISIBLE;
g_signal_emit (G_OBJECT (draw_tool), gimp_draw_tool_signals[DRAW], 0);
}
......@@ -249,15 +266,12 @@ gimp_draw_tool_calc_distance (GimpDrawTool *draw_tool,
gdouble x2,
gdouble y2)
{
GimpTool *tool;
gdouble tx1, ty1;
gdouble tx2, ty2;
gdouble tx1, ty1;
gdouble tx2, ty2;
g_return_val_if_fail (GIMP_IS_DRAW_TOOL (draw_tool), 0.0);
g_return_val_if_fail (GIMP_IS_DISPLAY (gdisp), 0.0);