Gimp/app/tools/gimpfuzzyselecttool.c
William Skaggs 73a25c2a61 Bill Skaggs <weskaggs@primate.ucdavis.edu>
* app/tools/gimpairbrushtool.c
	* app/tools/gimpaligntool.c
	* app/tools/gimpblendtool.c
	* app/tools/gimpbrightnesscontrasttool.c
	* app/tools/gimpbucketfilltool.c
	* app/tools/gimpbycolorselecttool.c
	* app/tools/gimpclonetool.c
	* app/tools/gimpcolorbalancetool.c
	* app/tools/gimpcolorizetool.c
	* app/tools/gimpcolorpickertool.c
	* app/tools/gimpconvolvetool.c
	* app/tools/gimpcroptool.c
	* app/tools/gimpcurvestool.c
	* app/tools/gimpdodgeburntool.c
	* app/tools/gimpellipseselecttool.c
	* app/tools/gimperasertool.c
	* app/tools/gimpfliptool.c
	* app/tools/gimpforegroundselecttool.c
	* app/tools/gimpfreeselecttool.c
	* app/tools/gimpfuzzyselecttool.c
	* app/tools/gimphealtool.c
	* app/tools/gimphuesaturationtool.c
	* app/tools/gimpinktool.c
	* app/tools/gimpiscissorstool.c
	* app/tools/gimplevelstool.c
	* app/tools/gimpmagnifytool.c
	* app/tools/gimpmeasuretool.c
	* app/tools/gimpmovetool.c
	* app/tools/gimppaintbrushtool.c
	* app/tools/gimppenciltool.c
	* app/tools/gimpperspectiveclonetool.c
	* app/tools/gimpperspectivetool.c
	* app/tools/gimpposterizetool.c
	* app/tools/gimprectangleselecttool.c
	* app/tools/gimprectangletool.c
	* app/tools/gimprotatetool.c
	* app/tools/gimpscaletool.c
	* app/tools/gimpsheartool.c
	* app/tools/gimpsmudgetool.c
	* app/tools/gimptexttool.c
	* app/tools/gimpthresholdtool.c
	* app/tools/gimpvectortool.c:  Apply patch from J. Baker,
	with some modifications, to improve tooltips and tool
	names.  Almost fixes bug #356137.
2006-09-18 18:00:22 +00:00

122 lines
3.8 KiB
C

/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimpfuzzyselecttool.c
*
* 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
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "tools-types.h"
#include "core/gimpimage.h"
#include "core/gimpimage-contiguous-region.h"
#include "core/gimpitem.h"
#include "widgets/gimphelp-ids.h"
#include "display/gimpdisplay.h"
#include "gimpfuzzyselecttool.h"
#include "gimpselectionoptions.h"
#include "gimptoolcontrol.h"
#include "gimp-intl.h"
static GimpChannel * gimp_fuzzy_select_tool_get_mask (GimpRegionSelectTool *region_select,
GimpDisplay *display);
G_DEFINE_TYPE (GimpFuzzySelectTool, gimp_fuzzy_select_tool,
GIMP_TYPE_REGION_SELECT_TOOL)
#define parent_class gimp_fuzzy_select_tool_parent_class
void
gimp_fuzzy_select_tool_register (GimpToolRegisterCallback callback,
gpointer data)
{
(* callback) (GIMP_TYPE_FUZZY_SELECT_TOOL,
GIMP_TYPE_SELECTION_OPTIONS,
gimp_selection_options_gui,
0,
"gimp-fuzzy-select-tool",
_("Fuzzy Select"),
_("Fuzzy Select Tool: Select a contiguous region on the basis of color"),
N_("Fu_zzy Select"), "U",
NULL, GIMP_HELP_TOOL_FUZZY_SELECT,
GIMP_STOCK_TOOL_FUZZY_SELECT,
data);
}
static void
gimp_fuzzy_select_tool_class_init (GimpFuzzySelectToolClass *klass)
{
GimpRegionSelectToolClass *region_class;
region_class = GIMP_REGION_SELECT_TOOL_CLASS (klass);
region_class->undo_desc = Q_("command|Fuzzy Select");
region_class->get_mask = gimp_fuzzy_select_tool_get_mask;
}
static void
gimp_fuzzy_select_tool_init (GimpFuzzySelectTool *fuzzy_select)
{
GimpTool *tool = GIMP_TOOL (fuzzy_select);
gimp_tool_control_set_tool_cursor (tool->control,
GIMP_TOOL_CURSOR_FUZZY_SELECT);
}
static GimpChannel *
gimp_fuzzy_select_tool_get_mask (GimpRegionSelectTool *region_select,
GimpDisplay *display)
{
GimpTool *tool = GIMP_TOOL (region_select);
GimpSelectionOptions *options = GIMP_SELECTION_TOOL_GET_OPTIONS (tool);
GimpDrawable *drawable;
gint x, y;
drawable = gimp_image_active_drawable (display->image);
x = region_select->x;
y = region_select->y;
if (! options->sample_merged)
{
gint off_x, off_y;
gimp_item_offsets (GIMP_ITEM (drawable), &off_x, &off_y);
x -= off_x;
y -= off_y;
}
return gimp_image_contiguous_region_by_seed (display->image, drawable,
options->sample_merged,
options->antialias,
options->threshold,
options->select_transparent,
options->select_criterion,
x, y);
}