1997-11-25 06:05:25 +08:00
|
|
|
/* The GIMP -- an image manipulation program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
1998-04-13 13:44:11 +08:00
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
1997-11-25 06:05:25 +08:00
|
|
|
*/
|
2000-07-30 00:12:40 +08:00
|
|
|
|
2000-12-17 05:37:03 +08:00
|
|
|
#include "config.h"
|
|
|
|
|
2000-12-29 23:22:01 +08:00
|
|
|
#include <gtk/gtk.h>
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2001-08-06 00:08:19 +08:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
|
2001-05-10 06:34:59 +08:00
|
|
|
#include "tools-types.h"
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimpchannel.h"
|
2003-10-06 20:17:11 +08:00
|
|
|
#include "core/gimpchannel-select.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimpimage.h"
|
2002-02-22 06:19:45 +08:00
|
|
|
#include "core/gimplayer-floating-sel.h"
|
2001-11-20 21:53:21 +08:00
|
|
|
#include "core/gimptoolinfo.h"
|
2001-01-25 06:36:18 +08:00
|
|
|
|
2003-08-22 09:42:57 +08:00
|
|
|
#include "widgets/gimphelp-ids.h"
|
|
|
|
|
2001-09-26 07:23:09 +08:00
|
|
|
#include "display/gimpdisplay.h"
|
|
|
|
|
2001-03-10 01:39:18 +08:00
|
|
|
#include "gimpfreeselecttool.h"
|
2003-02-09 05:12:03 +08:00
|
|
|
#include "gimpselectionoptions.h"
|
2003-04-16 00:05:52 +08:00
|
|
|
#include "gimptoolcontrol.h"
|
2001-03-10 01:39:18 +08:00
|
|
|
|
2003-03-26 00:38:19 +08:00
|
|
|
#include "gimp-intl.h"
|
2001-03-10 01:39:18 +08:00
|
|
|
|
2000-07-30 00:12:40 +08:00
|
|
|
|
2001-10-22 20:13:44 +08:00
|
|
|
#define DEFAULT_MAX_INC 1024
|
1999-04-09 06:25:54 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-03-10 01:39:18 +08:00
|
|
|
static void gimp_free_select_tool_class_init (GimpFreeSelectToolClass *klass);
|
|
|
|
static void gimp_free_select_tool_init (GimpFreeSelectTool *free_select);
|
2001-11-09 03:14:51 +08:00
|
|
|
static void gimp_free_select_tool_finalize (GObject *object);
|
|
|
|
|
2005-08-01 02:29:10 +08:00
|
|
|
static void gimp_free_select_tool_control (GimpTool *tool,
|
|
|
|
GimpToolAction action,
|
|
|
|
GimpDisplay *gdisp);
|
2001-11-09 03:14:51 +08:00
|
|
|
static void gimp_free_select_tool_button_press (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp);
|
|
|
|
static void gimp_free_select_tool_button_release (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp);
|
|
|
|
static void gimp_free_select_tool_motion (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp);
|
|
|
|
|
|
|
|
static void gimp_free_select_tool_draw (GimpDrawTool *draw_tool);
|
2000-03-02 07:22:43 +08:00
|
|
|
|
2005-08-07 04:01:22 +08:00
|
|
|
static void gimp_free_select_tool_real_select (GimpFreeSelectTool *free_sel,
|
2005-07-29 11:28:27 +08:00
|
|
|
GimpDisplay *gdisp);
|
2005-07-29 09:48:56 +08:00
|
|
|
|
2001-03-10 01:39:18 +08:00
|
|
|
static void gimp_free_select_tool_add_point (GimpFreeSelectTool *free_sel,
|
2001-11-09 03:14:51 +08:00
|
|
|
gdouble x,
|
|
|
|
gdouble y);
|
2003-05-27 19:52:03 +08:00
|
|
|
static void gimp_free_select_tool_move_points (GimpFreeSelectTool *free_sel,
|
|
|
|
gdouble dx,
|
|
|
|
gdouble dy);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2000-12-31 12:07:42 +08:00
|
|
|
|
2001-03-10 01:39:18 +08:00
|
|
|
static GimpSelectionToolClass *parent_class = NULL;
|
1999-04-13 01:55:06 +08:00
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-03-10 01:39:18 +08:00
|
|
|
/* public functions */
|
1999-04-09 06:25:54 +08:00
|
|
|
|
2001-03-10 01:39:18 +08:00
|
|
|
void
|
2002-03-29 11:50:29 +08:00
|
|
|
gimp_free_select_tool_register (GimpToolRegisterCallback callback,
|
2002-05-03 19:31:08 +08:00
|
|
|
gpointer data)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2002-03-29 11:50:29 +08:00
|
|
|
(* callback) (GIMP_TYPE_FREE_SELECT_TOOL,
|
2003-02-05 22:39:40 +08:00
|
|
|
GIMP_TYPE_SELECTION_OPTIONS,
|
|
|
|
gimp_selection_options_gui,
|
2003-06-28 19:20:37 +08:00
|
|
|
0,
|
2002-03-21 20:17:17 +08:00
|
|
|
"gimp-free-select-tool",
|
2001-11-21 07:00:47 +08:00
|
|
|
_("Free Select"),
|
|
|
|
_("Select hand-drawn regions"),
|
2004-04-29 21:19:28 +08:00
|
|
|
N_("_Free Select"), "F",
|
2003-08-22 09:42:57 +08:00
|
|
|
NULL, GIMP_HELP_TOOL_FREE_SELECT,
|
2002-03-29 11:50:29 +08:00
|
|
|
GIMP_STOCK_TOOL_FREE_SELECT,
|
2002-05-03 19:31:08 +08:00
|
|
|
data);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
GType
|
2001-03-10 01:39:18 +08:00
|
|
|
gimp_free_select_tool_get_type (void)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-08-14 22:53:55 +08:00
|
|
|
static GType tool_type = 0;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
if (! tool_type)
|
2001-03-10 01:39:18 +08:00
|
|
|
{
|
2001-08-14 22:53:55 +08:00
|
|
|
static const GTypeInfo tool_info =
|
2001-03-10 01:39:18 +08:00
|
|
|
{
|
|
|
|
sizeof (GimpFreeSelectToolClass),
|
2004-06-05 07:08:29 +08:00
|
|
|
(GBaseInitFunc) NULL,
|
|
|
|
(GBaseFinalizeFunc) NULL,
|
|
|
|
(GClassInitFunc) gimp_free_select_tool_class_init,
|
|
|
|
NULL, /* class_finalize */
|
|
|
|
NULL, /* class_data */
|
|
|
|
sizeof (GimpFreeSelectTool),
|
|
|
|
0, /* n_preallocs */
|
|
|
|
(GInstanceInitFunc) gimp_free_select_tool_init,
|
2001-03-10 01:39:18 +08:00
|
|
|
};
|
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
tool_type = g_type_register_static (GIMP_TYPE_SELECTION_TOOL,
|
2004-06-05 07:08:29 +08:00
|
|
|
"GimpFreeSelectTool",
|
2001-08-14 22:53:55 +08:00
|
|
|
&tool_info, 0);
|
2001-03-10 01:39:18 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
return tool_type;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2005-08-07 04:01:22 +08:00
|
|
|
void
|
|
|
|
gimp_free_select_tool_select (GimpFreeSelectTool *free_sel,
|
|
|
|
GimpDisplay *gdisp)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_FREE_SELECT_TOOL (free_sel));
|
|
|
|
g_return_if_fail (GIMP_IS_DISPLAY (gdisp));
|
|
|
|
|
|
|
|
GIMP_FREE_SELECT_TOOL_GET_CLASS (free_sel)->select (free_sel, gdisp);
|
|
|
|
}
|
|
|
|
|
2001-03-10 01:39:18 +08:00
|
|
|
/* private functions */
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_free_select_tool_class_init (GimpFreeSelectToolClass *klass)
|
|
|
|
{
|
2004-06-05 07:08:29 +08:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
|
|
|
|
GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass);
|
2001-03-10 01:39:18 +08:00
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
2001-03-10 01:39:18 +08:00
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
object_class->finalize = gimp_free_select_tool_finalize;
|
2001-03-10 01:39:18 +08:00
|
|
|
|
2005-08-01 02:29:10 +08:00
|
|
|
tool_class->control = gimp_free_select_tool_control;
|
2001-03-10 01:39:18 +08:00
|
|
|
tool_class->button_press = gimp_free_select_tool_button_press;
|
|
|
|
tool_class->button_release = gimp_free_select_tool_button_release;
|
|
|
|
tool_class->motion = gimp_free_select_tool_motion;
|
|
|
|
|
|
|
|
draw_tool_class->draw = gimp_free_select_tool_draw;
|
2005-07-29 09:48:56 +08:00
|
|
|
|
2005-08-07 04:01:22 +08:00
|
|
|
klass->select = gimp_free_select_tool_real_select;
|
2001-03-10 01:39:18 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_free_select_tool_init (GimpFreeSelectTool *free_select)
|
|
|
|
{
|
2004-06-05 07:08:29 +08:00
|
|
|
GimpTool *tool = GIMP_TOOL (free_select);
|
2001-03-10 01:39:18 +08:00
|
|
|
|
2002-05-03 05:03:27 +08:00
|
|
|
gimp_tool_control_set_scroll_lock (tool->control, TRUE);
|
2004-06-05 07:08:29 +08:00
|
|
|
gimp_tool_control_set_tool_cursor (tool->control,
|
|
|
|
GIMP_TOOL_CURSOR_FREE_SELECT);
|
2002-03-29 11:50:29 +08:00
|
|
|
|
2001-03-10 01:39:18 +08:00
|
|
|
free_select->points = NULL;
|
|
|
|
free_select->num_points = 0;
|
|
|
|
free_select->max_segs = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-08-14 22:53:55 +08:00
|
|
|
gimp_free_select_tool_finalize (GObject *object)
|
2001-03-10 01:39:18 +08:00
|
|
|
{
|
2004-06-05 07:08:29 +08:00
|
|
|
GimpFreeSelectTool *free_sel = GIMP_FREE_SELECT_TOOL (object);
|
2001-03-10 01:39:18 +08:00
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
if (free_sel->points)
|
|
|
|
{
|
|
|
|
g_free (free_sel->points);
|
|
|
|
free_sel->points = NULL;
|
|
|
|
}
|
2001-03-10 01:39:18 +08:00
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
2001-03-10 01:39:18 +08:00
|
|
|
}
|
|
|
|
|
2005-08-01 02:29:10 +08:00
|
|
|
static void
|
|
|
|
gimp_free_select_tool_control (GimpTool *tool,
|
|
|
|
GimpToolAction action,
|
|
|
|
GimpDisplay *gdisp)
|
|
|
|
{
|
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case HALT:
|
|
|
|
GIMP_FREE_SELECT_TOOL (tool)->num_points = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
|
|
|
|
}
|
|
|
|
|
2000-12-31 12:07:42 +08:00
|
|
|
static void
|
2001-11-09 03:14:51 +08:00
|
|
|
gimp_free_select_tool_button_press (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2004-06-05 07:08:29 +08:00
|
|
|
GimpFreeSelectTool *free_sel = GIMP_FREE_SELECT_TOOL (tool);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-05-03 19:31:08 +08:00
|
|
|
gimp_tool_control_activate (tool->control);
|
2001-11-09 03:14:51 +08:00
|
|
|
tool->gdisp = gdisp;
|
|
|
|
|
2004-07-26 22:50:51 +08:00
|
|
|
if (gimp_selection_tool_start_edit (GIMP_SELECTION_TOOL (free_sel), coords))
|
|
|
|
return;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-05-27 19:52:03 +08:00
|
|
|
free_sel->last_coords = *coords;
|
|
|
|
free_sel->num_points = 0;
|
2001-03-10 01:39:18 +08:00
|
|
|
|
2001-11-09 03:14:51 +08:00
|
|
|
gimp_free_select_tool_add_point (free_sel, coords->x, coords->y);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2002-02-03 20:10:23 +08:00
|
|
|
gimp_draw_tool_start (GIMP_DRAW_TOOL (tool), gdisp);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2000-12-31 12:07:42 +08:00
|
|
|
static void
|
2001-11-09 03:14:51 +08:00
|
|
|
gimp_free_select_tool_button_release (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2004-06-05 07:08:29 +08:00
|
|
|
GimpFreeSelectTool *free_sel = GIMP_FREE_SELECT_TOOL (tool);
|
2003-02-05 22:39:40 +08:00
|
|
|
GimpSelectionOptions *options;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-02-05 22:39:40 +08:00
|
|
|
options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options);
|
2001-11-20 21:53:21 +08:00
|
|
|
|
2001-03-10 01:39:18 +08:00
|
|
|
gimp_draw_tool_stop (GIMP_DRAW_TOOL (tool));
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2003-01-03 21:59:23 +08:00
|
|
|
gimp_tool_control_halt (tool->control);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* First take care of the case where the user "cancels" the action */
|
2005-07-29 08:16:45 +08:00
|
|
|
if (state & GDK_BUTTON3_MASK)
|
|
|
|
return;
|
2000-07-30 00:12:40 +08:00
|
|
|
|
2005-07-29 08:16:45 +08:00
|
|
|
if (free_sel->num_points == 1)
|
|
|
|
{
|
|
|
|
/* If there is a floating selection, anchor it */
|
|
|
|
if (gimp_image_floating_sel (gdisp->gimage))
|
2005-07-29 09:48:56 +08:00
|
|
|
{
|
|
|
|
floating_sel_anchor (gimp_image_floating_sel (gdisp->gimage));
|
|
|
|
}
|
2005-07-29 08:16:45 +08:00
|
|
|
/* Otherwise, clear the selection mask */
|
|
|
|
else
|
2005-07-29 09:48:56 +08:00
|
|
|
{
|
|
|
|
gimp_channel_clear (gimp_image_get_mask (gdisp->gimage), NULL, TRUE);
|
|
|
|
}
|
2005-07-29 08:16:45 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-07-29 11:28:27 +08:00
|
|
|
GIMP_FREE_SELECT_TOOL_GET_CLASS (free_sel)->select (free_sel, gdisp);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2005-07-29 08:16:45 +08:00
|
|
|
|
|
|
|
gimp_image_flush (gdisp->gimage);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
2000-12-31 12:07:42 +08:00
|
|
|
static void
|
2001-11-09 03:14:51 +08:00
|
|
|
gimp_free_select_tool_motion (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *gdisp)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2004-06-05 07:08:29 +08:00
|
|
|
GimpFreeSelectTool *free_sel = GIMP_FREE_SELECT_TOOL (tool);
|
|
|
|
GimpSelectionTool *sel_tool = GIMP_SELECTION_TOOL (tool);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-03-10 01:39:18 +08:00
|
|
|
if (sel_tool->op == SELECTION_ANCHOR)
|
2000-07-30 00:12:40 +08:00
|
|
|
{
|
2001-03-10 01:39:18 +08:00
|
|
|
sel_tool->op = SELECTION_REPLACE;
|
2000-07-30 00:12:40 +08:00
|
|
|
|
2001-11-09 03:14:51 +08:00
|
|
|
gimp_tool_cursor_update (tool, coords, state, gdisp);
|
2000-07-30 00:12:40 +08:00
|
|
|
}
|
|
|
|
|
2003-05-27 19:52:03 +08:00
|
|
|
if (state & GDK_MOD1_MASK)
|
|
|
|
{
|
|
|
|
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
|
2001-11-09 03:14:51 +08:00
|
|
|
|
2003-05-27 19:52:03 +08:00
|
|
|
gimp_free_select_tool_move_points (free_sel,
|
|
|
|
coords->x - free_sel->last_coords.x,
|
|
|
|
coords->y - free_sel->last_coords.y);
|
|
|
|
|
|
|
|
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gimp_free_select_tool_add_point (free_sel, coords->x, coords->y);
|
|
|
|
|
|
|
|
gimp_draw_tool_draw_line (GIMP_DRAW_TOOL (tool),
|
|
|
|
free_sel->points[free_sel->num_points - 2].x,
|
|
|
|
free_sel->points[free_sel->num_points - 2].y,
|
|
|
|
free_sel->points[free_sel->num_points - 1].x,
|
|
|
|
free_sel->points[free_sel->num_points - 1].y,
|
|
|
|
FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
free_sel->last_coords = *coords;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-03-10 01:39:18 +08:00
|
|
|
gimp_free_select_tool_draw (GimpDrawTool *draw_tool)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2004-06-05 07:08:29 +08:00
|
|
|
GimpFreeSelectTool *free_sel = GIMP_FREE_SELECT_TOOL (draw_tool);
|
2001-03-10 01:39:18 +08:00
|
|
|
gint i;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-03-10 01:39:18 +08:00
|
|
|
for (i = 1; i < free_sel->num_points; i++)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-11-12 22:45:58 +08:00
|
|
|
gimp_draw_tool_draw_line (draw_tool,
|
|
|
|
free_sel->points[i - 1].x,
|
|
|
|
free_sel->points[i - 1].y,
|
|
|
|
free_sel->points[i].x,
|
|
|
|
free_sel->points[i].y,
|
|
|
|
FALSE);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-07-29 09:48:56 +08:00
|
|
|
static void
|
2005-08-07 04:01:22 +08:00
|
|
|
gimp_free_select_tool_real_select (GimpFreeSelectTool *free_sel,
|
|
|
|
GimpDisplay *gdisp)
|
2005-07-29 09:48:56 +08:00
|
|
|
{
|
|
|
|
GimpTool *tool = GIMP_TOOL (free_sel);
|
|
|
|
GimpSelectionOptions *options;
|
|
|
|
|
|
|
|
options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options);
|
|
|
|
|
2005-07-29 11:28:27 +08:00
|
|
|
gimp_channel_select_polygon (gimp_image_get_mask (gdisp->gimage),
|
2005-07-29 09:48:56 +08:00
|
|
|
tool->tool_info->blurb,
|
|
|
|
free_sel->num_points,
|
|
|
|
free_sel->points,
|
|
|
|
GIMP_SELECTION_TOOL (tool)->op,
|
|
|
|
options->antialias,
|
|
|
|
options->feather,
|
|
|
|
options->feather_radius,
|
|
|
|
options->feather_radius);
|
|
|
|
}
|
|
|
|
|
2001-03-10 01:39:18 +08:00
|
|
|
static void
|
|
|
|
gimp_free_select_tool_add_point (GimpFreeSelectTool *free_sel,
|
2001-11-09 03:14:51 +08:00
|
|
|
gdouble x,
|
|
|
|
gdouble y)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2001-03-10 01:39:18 +08:00
|
|
|
if (free_sel->num_points >= free_sel->max_segs)
|
1999-04-13 01:55:06 +08:00
|
|
|
{
|
2001-03-10 01:39:18 +08:00
|
|
|
free_sel->max_segs += DEFAULT_MAX_INC;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-11-09 03:14:51 +08:00
|
|
|
free_sel->points = g_realloc (free_sel->points,
|
|
|
|
sizeof (GimpVector2) * free_sel->max_segs);
|
2001-03-10 01:39:18 +08:00
|
|
|
}
|
2001-02-25 03:29:47 +08:00
|
|
|
|
2001-03-10 01:39:18 +08:00
|
|
|
free_sel->points[free_sel->num_points].x = x;
|
|
|
|
free_sel->points[free_sel->num_points].y = y;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-03-10 01:39:18 +08:00
|
|
|
free_sel->num_points++;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2003-05-27 19:52:03 +08:00
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_free_select_tool_move_points (GimpFreeSelectTool *free_sel,
|
|
|
|
gdouble dx,
|
|
|
|
gdouble dy)
|
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
for (i = 0; i < free_sel->num_points; i++)
|
|
|
|
{
|
|
|
|
free_sel->points[i].x += dx;
|
|
|
|
free_sel->points[i].y += dy;
|
|
|
|
}
|
|
|
|
}
|