2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2001-06-26 20:09:43 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2001-06-26 20:09:43 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2001-06-26 20:09:43 +08:00
|
|
|
* (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
|
2009-01-18 06:28:01 +08:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2001-06-26 20:09:43 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2008-10-10 04:24:04 +08:00
|
|
|
#include <gegl.h>
|
2001-06-26 20:09:43 +08:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
#include "libgimpmath/gimpmath.h"
|
2016-09-27 06:00:39 +08:00
|
|
|
#include "libgimpconfig/gimpconfig.h"
|
2001-06-26 20:09:43 +08:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
|
2004-04-20 21:25:55 +08:00
|
|
|
#include "actions-types.h"
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2016-08-26 21:43:25 +08:00
|
|
|
#include "config/gimpdialogconfig.h"
|
|
|
|
|
2004-10-18 19:29:58 +08:00
|
|
|
#include "core/gimp.h"
|
removed the feather(), sharpen(), all(), invert(), border(), grow() and
2003-09-03 Michael Natterer <mitch@gimp.org>
* app/core/gimpimage-mask.[ch]: removed the feather(), sharpen(),
all(), invert(), border(), grow() and shrink() wrappers.
* app/core/gimpselection.[ch]: changed gimp_selection_invalidate()
and gimp_selection_push_undo() to take GimpChannel parameters, not
GimpSelection ones. They will be made virtual GimpChannel
functions anyway.
* app/core/gimpedit.c
* app/gui/select-commands.c
* app/widgets/gimpselectioneditor.c
* tools/pdbgen/pdb/selection.pdb: changed accordingly.
* app/pdb/selection_cmds.c: regenerated.
2003-09-03 21:37:49 +08:00
|
|
|
#include "core/gimpchannel.h"
|
2001-06-26 20:09:43 +08:00
|
|
|
#include "core/gimpimage.h"
|
2003-09-05 04:18:08 +08:00
|
|
|
#include "core/gimpselection.h"
|
2008-10-24 15:37:46 +08:00
|
|
|
#include "core/gimpstrokeoptions.h"
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2003-08-21 23:54:47 +08:00
|
|
|
#include "widgets/gimphelp-ids.h"
|
2003-05-27 19:28:10 +08:00
|
|
|
#include "widgets/gimpdialogfactory.h"
|
2014-05-02 09:01:23 +08:00
|
|
|
#include "widgets/gimpwidgets-utils.h"
|
2012-01-31 06:33:21 +08:00
|
|
|
#include "widgets/gimpwindowstrategy.h"
|
2003-05-27 19:28:10 +08:00
|
|
|
|
2001-09-26 07:23:09 +08:00
|
|
|
#include "display/gimpdisplay.h"
|
2002-06-27 06:16:59 +08:00
|
|
|
#include "display/gimpdisplayshell.h"
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2016-09-12 06:03:22 +08:00
|
|
|
#include "dialogs/dialogs.h"
|
2016-03-16 03:52:22 +08:00
|
|
|
#include "dialogs/fill-dialog.h"
|
2004-09-13 23:15:23 +08:00
|
|
|
#include "dialogs/stroke-dialog.h"
|
2004-04-20 21:25:55 +08:00
|
|
|
|
2004-05-03 22:03:51 +08:00
|
|
|
#include "actions.h"
|
2003-05-27 19:28:10 +08:00
|
|
|
#include "select-commands.h"
|
|
|
|
|
2003-03-26 00:38:19 +08:00
|
|
|
#include "gimp-intl.h"
|
2001-06-26 20:09:43 +08:00
|
|
|
|
|
|
|
|
2004-05-03 22:46:29 +08:00
|
|
|
/* local function prototypes */
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2016-09-27 17:15:52 +08:00
|
|
|
static void select_feather_callback (GtkWidget *widget,
|
|
|
|
gdouble size,
|
|
|
|
GimpUnit unit,
|
|
|
|
gpointer data);
|
|
|
|
static void select_border_callback (GtkWidget *widget,
|
|
|
|
gdouble size,
|
|
|
|
GimpUnit unit,
|
|
|
|
gpointer data);
|
|
|
|
static void select_grow_callback (GtkWidget *widget,
|
|
|
|
gdouble size,
|
|
|
|
GimpUnit unit,
|
|
|
|
gpointer data);
|
|
|
|
static void select_shrink_callback (GtkWidget *widget,
|
|
|
|
gdouble size,
|
|
|
|
GimpUnit unit,
|
|
|
|
gpointer data);
|
|
|
|
static void select_fill_callback (GtkWidget *dialog,
|
|
|
|
GimpItem *item,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
GimpContext *context,
|
|
|
|
GimpFillOptions *options,
|
|
|
|
gpointer data);
|
|
|
|
static void select_stroke_callback (GtkWidget *dialog,
|
|
|
|
GimpItem *item,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
GimpContext *context,
|
|
|
|
GimpStrokeOptions *options,
|
|
|
|
gpointer data);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
|
|
|
|
2004-10-24 03:13:17 +08:00
|
|
|
/* public functions */
|
|
|
|
|
2001-06-26 20:09:43 +08:00
|
|
|
void
|
2016-01-26 06:07:33 +08:00
|
|
|
select_all_cmd_callback (GtkAction *action,
|
|
|
|
gpointer data)
|
2001-06-26 20:09:43 +08:00
|
|
|
{
|
2006-03-29 01:08:36 +08:00
|
|
|
GimpImage *image;
|
|
|
|
return_if_no_image (image, data);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2016-01-26 06:07:33 +08:00
|
|
|
gimp_channel_all (gimp_image_get_mask (image), TRUE);
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_flush (image);
|
2001-06-26 20:09:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2016-01-26 06:07:33 +08:00
|
|
|
select_none_cmd_callback (GtkAction *action,
|
|
|
|
gpointer data)
|
2001-06-26 20:09:43 +08:00
|
|
|
{
|
2006-03-29 01:08:36 +08:00
|
|
|
GimpImage *image;
|
|
|
|
return_if_no_image (image, data);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2016-01-26 06:07:33 +08:00
|
|
|
gimp_channel_clear (gimp_image_get_mask (image), NULL, TRUE);
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_flush (image);
|
2001-06-26 20:09:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2016-01-26 06:07:33 +08:00
|
|
|
select_invert_cmd_callback (GtkAction *action,
|
|
|
|
gpointer data)
|
2001-06-26 20:09:43 +08:00
|
|
|
{
|
2006-03-29 01:08:36 +08:00
|
|
|
GimpImage *image;
|
|
|
|
return_if_no_image (image, data);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2016-01-26 06:07:33 +08:00
|
|
|
gimp_channel_invert (gimp_image_get_mask (image), TRUE);
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_flush (image);
|
2001-06-26 20:09:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
select_float_cmd_callback (GtkAction *action,
|
2004-05-25 22:37:02 +08:00
|
|
|
gpointer data)
|
2001-06-26 20:09:43 +08:00
|
|
|
{
|
2006-03-29 01:08:36 +08:00
|
|
|
GimpImage *image;
|
2007-10-06 20:30:28 +08:00
|
|
|
GtkWidget *widget;
|
2007-12-08 02:16:28 +08:00
|
|
|
GError *error = NULL;
|
2006-03-29 01:08:36 +08:00
|
|
|
return_if_no_image (image, data);
|
2007-10-06 20:30:28 +08:00
|
|
|
return_if_no_widget (widget, data);
|
|
|
|
|
2008-11-23 06:07:55 +08:00
|
|
|
if (gimp_selection_float (GIMP_SELECTION (gimp_image_get_mask (image)),
|
2007-10-06 20:30:28 +08:00
|
|
|
gimp_image_get_active_drawable (image),
|
|
|
|
action_data_get_context (data),
|
2007-12-08 02:16:28 +08:00
|
|
|
TRUE, 0, 0, &error))
|
2007-10-06 20:30:28 +08:00
|
|
|
{
|
|
|
|
gimp_image_flush (image);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-11-04 20:33:09 +08:00
|
|
|
gimp_message_literal (image->gimp,
|
2013-09-15 00:59:20 +08:00
|
|
|
G_OBJECT (widget), GIMP_MESSAGE_WARNING,
|
|
|
|
error->message);
|
2007-12-08 02:16:28 +08:00
|
|
|
g_clear_error (&error);
|
2007-10-06 20:30:28 +08:00
|
|
|
}
|
2001-06-26 20:09:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
select_feather_cmd_callback (GtkAction *action,
|
2004-05-25 22:37:02 +08:00
|
|
|
gpointer data)
|
2001-06-26 20:09:43 +08:00
|
|
|
{
|
2016-09-12 06:03:22 +08:00
|
|
|
GimpDisplay *display;
|
|
|
|
GimpImage *image;
|
|
|
|
GtkWidget *dialog;
|
2006-03-29 01:55:52 +08:00
|
|
|
return_if_no_display (display, data);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2016-09-12 06:03:22 +08:00
|
|
|
image = gimp_display_get_image (display);
|
|
|
|
|
|
|
|
#define FEATHER_DIALOG_KEY "gimp-selection-feather-dialog"
|
|
|
|
|
|
|
|
dialog = dialogs_get_dialog (G_OBJECT (image), FEATHER_DIALOG_KEY);
|
|
|
|
|
|
|
|
if (! dialog)
|
|
|
|
{
|
|
|
|
GimpDialogConfig *config = GIMP_DIALOG_CONFIG (image->gimp->config);
|
|
|
|
gdouble xres;
|
|
|
|
gdouble yres;
|
|
|
|
|
|
|
|
gimp_image_get_resolution (image, &xres, &yres);
|
|
|
|
|
|
|
|
dialog = gimp_query_size_box (_("Feather Selection"),
|
|
|
|
GTK_WIDGET (gimp_display_get_shell (display)),
|
|
|
|
gimp_standard_help_func,
|
|
|
|
GIMP_HELP_SELECTION_FEATHER,
|
|
|
|
_("Feather selection by"),
|
|
|
|
config->selection_feather_radius, 0, 32767, 3,
|
|
|
|
gimp_display_get_shell (display)->unit,
|
|
|
|
MIN (xres, yres),
|
|
|
|
FALSE,
|
|
|
|
G_OBJECT (image), "disconnect",
|
|
|
|
select_feather_callback, image);
|
|
|
|
|
|
|
|
dialogs_attach_dialog (G_OBJECT (image), FEATHER_DIALOG_KEY, dialog);
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_window_present (GTK_WINDOW (dialog));
|
2001-06-26 20:09:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
select_sharpen_cmd_callback (GtkAction *action,
|
2004-05-25 22:37:02 +08:00
|
|
|
gpointer data)
|
2001-06-26 20:09:43 +08:00
|
|
|
{
|
2006-03-29 01:08:36 +08:00
|
|
|
GimpImage *image;
|
|
|
|
return_if_no_image (image, data);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_channel_sharpen (gimp_image_get_mask (image), TRUE);
|
|
|
|
gimp_image_flush (image);
|
2001-06-26 20:09:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
select_shrink_cmd_callback (GtkAction *action,
|
2004-05-25 22:37:02 +08:00
|
|
|
gpointer data)
|
2001-06-26 20:09:43 +08:00
|
|
|
{
|
2016-09-12 06:03:22 +08:00
|
|
|
GimpDisplay *display;
|
|
|
|
GimpImage *image;
|
|
|
|
GtkWidget *dialog;
|
2006-03-29 01:55:52 +08:00
|
|
|
return_if_no_display (display, data);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2016-09-12 06:03:22 +08:00
|
|
|
image = gimp_display_get_image (display);
|
|
|
|
|
|
|
|
#define SHRINK_DIALOG_KEY "gimp-selection-shrink-dialog"
|
|
|
|
|
|
|
|
dialog = dialogs_get_dialog (G_OBJECT (image), SHRINK_DIALOG_KEY);
|
|
|
|
|
|
|
|
if (! dialog)
|
|
|
|
{
|
|
|
|
GimpDialogConfig *config = GIMP_DIALOG_CONFIG (image->gimp->config);
|
|
|
|
GtkWidget *button;
|
|
|
|
gdouble xres;
|
|
|
|
gdouble yres;
|
|
|
|
|
|
|
|
gimp_image_get_resolution (image, &xres, &yres);
|
|
|
|
|
|
|
|
dialog = gimp_query_size_box (_("Shrink Selection"),
|
|
|
|
GTK_WIDGET (gimp_display_get_shell (display)),
|
|
|
|
gimp_standard_help_func,
|
|
|
|
GIMP_HELP_SELECTION_SHRINK,
|
|
|
|
_("Shrink selection by"),
|
|
|
|
config->selection_shrink_radius, 1, 32767, 0,
|
|
|
|
gimp_display_get_shell (display)->unit,
|
|
|
|
MIN (xres, yres),
|
|
|
|
FALSE,
|
|
|
|
G_OBJECT (image), "disconnect",
|
|
|
|
select_shrink_callback, image);
|
|
|
|
|
|
|
|
/* Edge lock button */
|
|
|
|
button = gtk_check_button_new_with_mnemonic (_("_Selected areas continue outside the image"));
|
|
|
|
g_object_set_data (G_OBJECT (dialog), "edge-lock-toggle", button);
|
|
|
|
gimp_help_set_help_data (button,
|
|
|
|
_("When shrinking, act as if selected areas "
|
|
|
|
"continued outside the image."),
|
|
|
|
NULL);
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
|
|
|
|
config->selection_shrink_edge_lock);
|
|
|
|
gtk_box_pack_start (GTK_BOX (GIMP_QUERY_BOX_VBOX (dialog)), button,
|
|
|
|
FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (button);
|
|
|
|
|
|
|
|
dialogs_attach_dialog (G_OBJECT (image), SHRINK_DIALOG_KEY, dialog);
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_window_present (GTK_WINDOW (dialog));
|
2001-06-26 20:09:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
select_grow_cmd_callback (GtkAction *action,
|
2004-05-25 22:37:02 +08:00
|
|
|
gpointer data)
|
2001-06-26 20:09:43 +08:00
|
|
|
{
|
2016-09-12 06:03:22 +08:00
|
|
|
GimpDisplay *display;
|
|
|
|
GimpImage *image;
|
|
|
|
GtkWidget *dialog;
|
2006-03-29 01:55:52 +08:00
|
|
|
return_if_no_display (display, data);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2016-09-12 06:03:22 +08:00
|
|
|
image = gimp_display_get_image (display);
|
|
|
|
|
|
|
|
#define GROW_DIALOG_KEY "gimp-selection-grow-dialog"
|
|
|
|
|
|
|
|
dialog = dialogs_get_dialog (G_OBJECT (image), GROW_DIALOG_KEY);
|
|
|
|
|
|
|
|
if (! dialog)
|
|
|
|
{
|
|
|
|
GimpDialogConfig *config = GIMP_DIALOG_CONFIG (image->gimp->config);
|
|
|
|
gdouble xres;
|
|
|
|
gdouble yres;
|
|
|
|
|
|
|
|
gimp_image_get_resolution (image, &xres, &yres);
|
|
|
|
|
|
|
|
dialog = gimp_query_size_box (_("Grow Selection"),
|
|
|
|
GTK_WIDGET (gimp_display_get_shell (display)),
|
|
|
|
gimp_standard_help_func,
|
|
|
|
GIMP_HELP_SELECTION_GROW,
|
|
|
|
_("Grow selection by"),
|
|
|
|
config->selection_grow_radius, 1, 32767, 0,
|
|
|
|
gimp_display_get_shell (display)->unit,
|
|
|
|
MIN (xres, yres),
|
|
|
|
FALSE,
|
|
|
|
G_OBJECT (image), "disconnect",
|
|
|
|
select_grow_callback, image);
|
|
|
|
|
|
|
|
dialogs_attach_dialog (G_OBJECT (image), GROW_DIALOG_KEY, dialog);
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_window_present (GTK_WINDOW (dialog));
|
2001-06-26 20:09:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
select_border_cmd_callback (GtkAction *action,
|
2004-05-25 22:37:02 +08:00
|
|
|
gpointer data)
|
2001-06-26 20:09:43 +08:00
|
|
|
{
|
2016-09-12 06:03:22 +08:00
|
|
|
GimpDisplay *display;
|
|
|
|
GimpImage *image;
|
|
|
|
GtkWidget *dialog;
|
2006-03-29 01:55:52 +08:00
|
|
|
return_if_no_display (display, data);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2016-09-12 06:03:22 +08:00
|
|
|
image = gimp_display_get_image (display);
|
|
|
|
|
|
|
|
#define BORDER_DIALOG_KEY "gimp-selection-border-dialog"
|
|
|
|
|
|
|
|
dialog = dialogs_get_dialog (G_OBJECT (image), BORDER_DIALOG_KEY);
|
|
|
|
|
|
|
|
if (! dialog)
|
|
|
|
{
|
|
|
|
GimpDialogConfig *config = GIMP_DIALOG_CONFIG (image->gimp->config);
|
|
|
|
GtkWidget *combo;
|
|
|
|
GtkWidget *button;
|
|
|
|
gdouble xres;
|
|
|
|
gdouble yres;
|
|
|
|
|
|
|
|
gimp_image_get_resolution (image, &xres, &yres);
|
|
|
|
|
|
|
|
dialog = gimp_query_size_box (_("Border Selection"),
|
|
|
|
GTK_WIDGET (gimp_display_get_shell (display)),
|
|
|
|
gimp_standard_help_func,
|
|
|
|
GIMP_HELP_SELECTION_BORDER,
|
|
|
|
_("Border selection by"),
|
|
|
|
config->selection_border_radius, 1, 32767, 0,
|
|
|
|
gimp_display_get_shell (display)->unit,
|
|
|
|
MIN (xres, yres),
|
|
|
|
FALSE,
|
|
|
|
G_OBJECT (image), "disconnect",
|
|
|
|
select_border_callback, image);
|
|
|
|
|
|
|
|
/* Border style combo */
|
|
|
|
combo = gimp_enum_combo_box_new (GIMP_TYPE_CHANNEL_BORDER_STYLE);
|
|
|
|
gimp_int_combo_box_set_label (GIMP_INT_COMBO_BOX (combo),
|
|
|
|
_("Border style"));
|
|
|
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (GIMP_QUERY_BOX_VBOX (dialog)), combo,
|
|
|
|
FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
g_object_set_data (G_OBJECT (dialog), "border-style-combo", combo);
|
|
|
|
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo),
|
|
|
|
config->selection_border_style);
|
|
|
|
gtk_widget_show (combo);
|
|
|
|
|
|
|
|
/* Edge lock button */
|
|
|
|
button = gtk_check_button_new_with_mnemonic (_("_Selected areas continue outside the image"));
|
|
|
|
g_object_set_data (G_OBJECT (dialog), "edge-lock-toggle", button);
|
|
|
|
gimp_help_set_help_data (button,
|
|
|
|
_("When bordering, act as if selected areas "
|
|
|
|
"continued outside the image."),
|
|
|
|
NULL);
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
|
|
|
|
config->selection_border_edge_lock);
|
|
|
|
gtk_box_pack_start (GTK_BOX (GIMP_QUERY_BOX_VBOX (dialog)), button,
|
|
|
|
FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (button);
|
|
|
|
|
|
|
|
dialogs_attach_dialog (G_OBJECT (image), BORDER_DIALOG_KEY, dialog);
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_window_present (GTK_WINDOW (dialog));
|
2001-06-26 20:09:43 +08:00
|
|
|
}
|
|
|
|
|
2016-01-25 01:43:35 +08:00
|
|
|
void
|
|
|
|
select_flood_cmd_callback (GtkAction *action,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GimpImage *image;
|
|
|
|
return_if_no_image (image, data);
|
|
|
|
|
|
|
|
gimp_channel_flood (gimp_image_get_mask (image), TRUE);
|
|
|
|
gimp_image_flush (image);
|
|
|
|
}
|
|
|
|
|
2001-06-26 20:09:43 +08:00
|
|
|
void
|
2004-04-29 20:52:29 +08:00
|
|
|
select_save_cmd_callback (GtkAction *action,
|
2004-05-25 22:37:02 +08:00
|
|
|
gpointer data)
|
2001-06-26 20:09:43 +08:00
|
|
|
{
|
2006-03-29 01:08:36 +08:00
|
|
|
GimpImage *image;
|
2004-05-03 22:46:29 +08:00
|
|
|
GtkWidget *widget;
|
2006-03-29 01:08:36 +08:00
|
|
|
return_if_no_image (image, data);
|
2004-05-03 22:46:29 +08:00
|
|
|
return_if_no_widget (widget, data);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2008-11-23 06:07:55 +08:00
|
|
|
gimp_selection_save (GIMP_SELECTION (gimp_image_get_mask (image)));
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_flush (image);
|
2003-05-27 19:28:10 +08:00
|
|
|
|
2012-01-31 06:24:44 +08:00
|
|
|
gimp_window_strategy_show_dockable_dialog (GIMP_WINDOW_STRATEGY (gimp_get_window_strategy (image->gimp)),
|
|
|
|
image->gimp,
|
|
|
|
gimp_dialog_factory_get_singleton (),
|
|
|
|
gtk_widget_get_screen (widget),
|
2014-05-02 09:01:23 +08:00
|
|
|
gimp_widget_get_monitor (widget),
|
2012-01-31 06:24:44 +08:00
|
|
|
"gimp-channel-list");
|
2001-06-26 20:09:43 +08:00
|
|
|
}
|
|
|
|
|
2016-03-16 03:52:22 +08:00
|
|
|
void
|
|
|
|
select_fill_cmd_callback (GtkAction *action,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GimpImage *image;
|
|
|
|
GimpDrawable *drawable;
|
|
|
|
GtkWidget *widget;
|
|
|
|
GtkWidget *dialog;
|
|
|
|
return_if_no_image (image, data);
|
|
|
|
return_if_no_widget (widget, data);
|
|
|
|
|
|
|
|
drawable = gimp_image_get_active_drawable (image);
|
|
|
|
|
|
|
|
if (! drawable)
|
|
|
|
{
|
|
|
|
gimp_message_literal (image->gimp,
|
|
|
|
G_OBJECT (widget), GIMP_MESSAGE_WARNING,
|
|
|
|
_("There is no active layer or channel to fill."));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-09-12 06:03:22 +08:00
|
|
|
#define FILL_DIALOG_KEY "gimp-selection-fill-dialog"
|
|
|
|
|
|
|
|
dialog = dialogs_get_dialog (G_OBJECT (drawable), FILL_DIALOG_KEY);
|
|
|
|
|
|
|
|
if (! dialog)
|
|
|
|
{
|
2016-09-27 06:00:39 +08:00
|
|
|
GimpDialogConfig *config = GIMP_DIALOG_CONFIG (image->gimp->config);
|
|
|
|
|
2016-09-12 06:03:22 +08:00
|
|
|
dialog = fill_dialog_new (GIMP_ITEM (gimp_image_get_mask (image)),
|
2016-09-27 06:00:39 +08:00
|
|
|
drawable,
|
2016-09-12 06:03:22 +08:00
|
|
|
action_data_get_context (data),
|
|
|
|
_("Fill Selection Outline"),
|
|
|
|
GIMP_STOCK_TOOL_BUCKET_FILL,
|
|
|
|
GIMP_HELP_SELECTION_FILL,
|
2016-09-27 06:00:39 +08:00
|
|
|
widget,
|
|
|
|
config->fill_options,
|
|
|
|
select_fill_callback,
|
|
|
|
NULL);
|
2016-09-12 06:03:22 +08:00
|
|
|
|
|
|
|
dialogs_attach_dialog (G_OBJECT (drawable), FILL_DIALOG_KEY, dialog);
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_window_present (GTK_WINDOW (dialog));
|
2016-03-16 03:52:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
select_fill_last_vals_cmd_callback (GtkAction *action,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2016-09-14 07:27:42 +08:00
|
|
|
GimpImage *image;
|
|
|
|
GimpDrawable *drawable;
|
|
|
|
GtkWidget *widget;
|
|
|
|
GimpDialogConfig *config;
|
|
|
|
GError *error = NULL;
|
2016-03-16 03:52:22 +08:00
|
|
|
return_if_no_image (image, data);
|
|
|
|
return_if_no_widget (widget, data);
|
|
|
|
|
|
|
|
drawable = gimp_image_get_active_drawable (image);
|
|
|
|
|
|
|
|
if (! drawable)
|
|
|
|
{
|
|
|
|
gimp_message_literal (image->gimp,
|
|
|
|
G_OBJECT (widget), GIMP_MESSAGE_WARNING,
|
|
|
|
_("There is no active layer or channel to fill."));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-09-14 07:27:42 +08:00
|
|
|
config = GIMP_DIALOG_CONFIG (image->gimp->config);
|
2016-03-16 03:52:22 +08:00
|
|
|
|
|
|
|
if (! gimp_item_fill (GIMP_ITEM (gimp_image_get_mask (image)),
|
2016-09-14 07:27:42 +08:00
|
|
|
drawable, config->fill_options, TRUE, NULL, &error))
|
2016-03-16 03:52:22 +08:00
|
|
|
{
|
|
|
|
gimp_message_literal (image->gimp,
|
|
|
|
G_OBJECT (widget), GIMP_MESSAGE_WARNING,
|
|
|
|
error->message);
|
|
|
|
g_clear_error (&error);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gimp_image_flush (image);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-05-13 02:36:33 +08:00
|
|
|
void
|
|
|
|
select_stroke_cmd_callback (GtkAction *action,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2006-03-29 01:08:36 +08:00
|
|
|
GimpImage *image;
|
2004-05-13 02:36:33 +08:00
|
|
|
GimpDrawable *drawable;
|
|
|
|
GtkWidget *widget;
|
|
|
|
GtkWidget *dialog;
|
2006-03-29 01:08:36 +08:00
|
|
|
return_if_no_image (image, data);
|
2004-05-23 18:04:41 +08:00
|
|
|
return_if_no_widget (widget, data);
|
2004-05-13 02:36:33 +08:00
|
|
|
|
2007-07-19 22:59:51 +08:00
|
|
|
drawable = gimp_image_get_active_drawable (image);
|
2004-05-13 02:36:33 +08:00
|
|
|
|
2004-05-23 18:04:41 +08:00
|
|
|
if (! drawable)
|
2004-05-13 02:36:33 +08:00
|
|
|
{
|
2008-11-04 20:33:09 +08:00
|
|
|
gimp_message_literal (image->gimp,
|
2013-09-15 00:59:20 +08:00
|
|
|
G_OBJECT (widget), GIMP_MESSAGE_WARNING,
|
|
|
|
_("There is no active layer or channel to stroke to."));
|
2004-05-13 02:36:33 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-09-12 06:03:22 +08:00
|
|
|
#define STROKE_DIALOG_KEY "gimp-selection-stroke-dialog"
|
|
|
|
|
|
|
|
dialog = dialogs_get_dialog (G_OBJECT (drawable), STROKE_DIALOG_KEY);
|
|
|
|
|
|
|
|
if (! dialog)
|
|
|
|
{
|
2016-09-27 17:15:52 +08:00
|
|
|
GimpDialogConfig *config = GIMP_DIALOG_CONFIG (image->gimp->config);
|
|
|
|
|
2016-09-12 06:03:22 +08:00
|
|
|
dialog = stroke_dialog_new (GIMP_ITEM (gimp_image_get_mask (image)),
|
2016-09-27 17:15:52 +08:00
|
|
|
drawable,
|
2016-09-12 06:03:22 +08:00
|
|
|
action_data_get_context (data),
|
|
|
|
_("Stroke Selection"),
|
|
|
|
GIMP_STOCK_SELECTION_STROKE,
|
|
|
|
GIMP_HELP_SELECTION_STROKE,
|
2016-09-27 17:15:52 +08:00
|
|
|
widget,
|
|
|
|
config->stroke_options,
|
|
|
|
select_stroke_callback,
|
|
|
|
NULL);
|
2016-09-12 06:03:22 +08:00
|
|
|
|
|
|
|
dialogs_attach_dialog (G_OBJECT (drawable), STROKE_DIALOG_KEY, dialog);
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_window_present (GTK_WINDOW (dialog));
|
2004-05-13 02:36:33 +08:00
|
|
|
}
|
|
|
|
|
2004-10-18 19:29:58 +08:00
|
|
|
void
|
|
|
|
select_stroke_last_vals_cmd_callback (GtkAction *action,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2016-09-14 07:27:42 +08:00
|
|
|
GimpImage *image;
|
|
|
|
GimpDrawable *drawable;
|
|
|
|
GimpContext *context;
|
|
|
|
GtkWidget *widget;
|
|
|
|
GimpDialogConfig *config;
|
|
|
|
GError *error = NULL;
|
2004-10-18 19:29:58 +08:00
|
|
|
return_if_no_image (image, data);
|
2006-10-01 19:13:00 +08:00
|
|
|
return_if_no_context (context, data);
|
2006-10-10 02:49:15 +08:00
|
|
|
return_if_no_widget (widget, data);
|
2004-10-18 19:29:58 +08:00
|
|
|
|
2007-07-19 22:59:51 +08:00
|
|
|
drawable = gimp_image_get_active_drawable (image);
|
2004-10-18 19:29:58 +08:00
|
|
|
|
|
|
|
if (! drawable)
|
|
|
|
{
|
2008-11-04 20:33:09 +08:00
|
|
|
gimp_message_literal (image->gimp,
|
2013-09-15 00:59:20 +08:00
|
|
|
G_OBJECT (widget), GIMP_MESSAGE_WARNING,
|
|
|
|
_("There is no active layer or channel to stroke to."));
|
2004-10-18 19:29:58 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-09-14 07:27:42 +08:00
|
|
|
config = GIMP_DIALOG_CONFIG (image->gimp->config);
|
2004-10-18 19:29:58 +08:00
|
|
|
|
2007-12-07 02:40:12 +08:00
|
|
|
if (! gimp_item_stroke (GIMP_ITEM (gimp_image_get_mask (image)),
|
2016-09-14 07:27:42 +08:00
|
|
|
drawable, context, config->stroke_options, NULL,
|
2014-02-07 06:20:39 +08:00
|
|
|
TRUE, NULL, &error))
|
2007-12-07 02:40:12 +08:00
|
|
|
{
|
2008-11-04 20:33:09 +08:00
|
|
|
gimp_message_literal (image->gimp,
|
2013-09-15 00:59:20 +08:00
|
|
|
G_OBJECT (widget), GIMP_MESSAGE_WARNING,
|
|
|
|
error->message);
|
2007-12-07 02:40:12 +08:00
|
|
|
g_clear_error (&error);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gimp_image_flush (image);
|
|
|
|
}
|
2004-10-18 19:29:58 +08:00
|
|
|
}
|
|
|
|
|
2001-06-26 20:09:43 +08:00
|
|
|
|
|
|
|
/* private functions */
|
|
|
|
|
|
|
|
static void
|
2004-10-18 19:29:58 +08:00
|
|
|
select_feather_callback (GtkWidget *widget,
|
|
|
|
gdouble size,
|
|
|
|
GimpUnit unit,
|
|
|
|
gpointer data)
|
2001-06-26 20:09:43 +08:00
|
|
|
{
|
2016-08-26 21:43:25 +08:00
|
|
|
GimpImage *image = GIMP_IMAGE (data);
|
|
|
|
GimpDialogConfig *config = GIMP_DIALOG_CONFIG (image->gimp->config);
|
|
|
|
gdouble radius_x;
|
|
|
|
gdouble radius_y;
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2016-08-26 21:43:25 +08:00
|
|
|
g_object_set (config,
|
|
|
|
"selection-feather-radius", size,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
radius_x = config->selection_feather_radius;
|
|
|
|
radius_y = config->selection_feather_radius;
|
2001-06-26 20:09:43 +08:00
|
|
|
|
|
|
|
if (unit != GIMP_UNIT_PIXEL)
|
|
|
|
{
|
2007-12-27 01:33:41 +08:00
|
|
|
gdouble xres;
|
|
|
|
gdouble yres;
|
2001-06-26 20:09:43 +08:00
|
|
|
gdouble factor;
|
|
|
|
|
2007-12-27 01:33:41 +08:00
|
|
|
gimp_image_get_resolution (image, &xres, &yres);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2007-12-27 01:33:41 +08:00
|
|
|
factor = (MAX (xres, yres) /
|
|
|
|
MIN (xres, yres));
|
|
|
|
|
|
|
|
if (xres == MIN (xres, yres))
|
2004-05-25 22:37:02 +08:00
|
|
|
radius_y *= factor;
|
2001-06-26 20:09:43 +08:00
|
|
|
else
|
2004-05-25 22:37:02 +08:00
|
|
|
radius_x *= factor;
|
2001-06-26 20:09:43 +08:00
|
|
|
}
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_channel_feather (gimp_image_get_mask (image), radius_x, radius_y, TRUE);
|
|
|
|
gimp_image_flush (image);
|
2001-06-26 20:09:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-10-18 19:29:58 +08:00
|
|
|
select_border_callback (GtkWidget *widget,
|
|
|
|
gdouble size,
|
|
|
|
GimpUnit unit,
|
|
|
|
gpointer data)
|
2001-06-26 20:09:43 +08:00
|
|
|
{
|
2016-08-26 21:43:25 +08:00
|
|
|
GimpImage *image = GIMP_IMAGE (data);
|
|
|
|
GimpDialogConfig *config = GIMP_DIALOG_CONFIG (image->gimp->config);
|
|
|
|
GtkWidget *combo;
|
|
|
|
GtkWidget *button;
|
|
|
|
gdouble radius_x;
|
|
|
|
gdouble radius_y;
|
|
|
|
gint border_style;
|
|
|
|
|
|
|
|
combo = g_object_get_data (G_OBJECT (widget), "border-style-combo");
|
|
|
|
button = g_object_get_data (G_OBJECT (widget), "edge-lock-toggle");
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2016-08-26 21:43:25 +08:00
|
|
|
gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (combo), &border_style);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2016-08-26 21:43:25 +08:00
|
|
|
g_object_set (config,
|
|
|
|
"selection-border-radius", size,
|
|
|
|
"selection-border-style", border_style,
|
|
|
|
"selection-border-edge-lock",
|
|
|
|
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)),
|
|
|
|
NULL);
|
2007-03-06 04:21:23 +08:00
|
|
|
|
2016-08-26 21:43:25 +08:00
|
|
|
radius_x = ROUND (config->selection_border_radius);
|
|
|
|
radius_y = ROUND (config->selection_border_radius);
|
2006-06-06 02:33:49 +08:00
|
|
|
|
2001-06-26 20:09:43 +08:00
|
|
|
if (unit != GIMP_UNIT_PIXEL)
|
|
|
|
{
|
2007-12-27 01:33:41 +08:00
|
|
|
gdouble xres;
|
|
|
|
gdouble yres;
|
2001-06-26 20:09:43 +08:00
|
|
|
gdouble factor;
|
|
|
|
|
2007-12-27 01:33:41 +08:00
|
|
|
gimp_image_get_resolution (image, &xres, &yres);
|
|
|
|
|
|
|
|
factor = (MAX (xres, yres) /
|
|
|
|
MIN (xres, yres));
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2007-12-27 01:33:41 +08:00
|
|
|
if (xres == MIN (xres, yres))
|
2004-05-25 22:37:02 +08:00
|
|
|
radius_y *= factor;
|
2001-06-26 20:09:43 +08:00
|
|
|
else
|
2004-05-25 22:37:02 +08:00
|
|
|
radius_x *= factor;
|
2001-06-26 20:09:43 +08:00
|
|
|
}
|
|
|
|
|
2006-06-06 02:33:49 +08:00
|
|
|
gimp_channel_border (gimp_image_get_mask (image), radius_x, radius_y,
|
2016-08-26 21:43:25 +08:00
|
|
|
config->selection_border_style,
|
|
|
|
config->selection_border_edge_lock,
|
|
|
|
TRUE);
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_flush (image);
|
2001-06-26 20:09:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-10-18 19:29:58 +08:00
|
|
|
select_grow_callback (GtkWidget *widget,
|
|
|
|
gdouble size,
|
|
|
|
GimpUnit unit,
|
|
|
|
gpointer data)
|
2001-06-26 20:09:43 +08:00
|
|
|
{
|
2016-08-26 21:43:25 +08:00
|
|
|
GimpImage *image = GIMP_IMAGE (data);
|
|
|
|
GimpDialogConfig *config = GIMP_DIALOG_CONFIG (image->gimp->config);
|
|
|
|
gdouble radius_x;
|
|
|
|
gdouble radius_y;
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2016-08-26 21:43:25 +08:00
|
|
|
g_object_set (config,
|
|
|
|
"selection-grow-radius", size,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
radius_x = ROUND (config->selection_grow_radius);
|
|
|
|
radius_y = ROUND (config->selection_grow_radius);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
|
|
|
if (unit != GIMP_UNIT_PIXEL)
|
|
|
|
{
|
2007-12-27 01:33:41 +08:00
|
|
|
gdouble xres;
|
|
|
|
gdouble yres;
|
2001-06-26 20:09:43 +08:00
|
|
|
gdouble factor;
|
|
|
|
|
2007-12-27 01:33:41 +08:00
|
|
|
gimp_image_get_resolution (image, &xres, &yres);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2007-12-27 01:33:41 +08:00
|
|
|
factor = (MAX (xres, yres) /
|
|
|
|
MIN (xres, yres));
|
|
|
|
|
|
|
|
if (xres == MIN (xres, yres))
|
2004-05-25 22:37:02 +08:00
|
|
|
radius_y *= factor;
|
2001-06-26 20:09:43 +08:00
|
|
|
else
|
2004-05-25 22:37:02 +08:00
|
|
|
radius_x *= factor;
|
2001-06-26 20:09:43 +08:00
|
|
|
}
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_channel_grow (gimp_image_get_mask (image), radius_x, radius_y, TRUE);
|
|
|
|
gimp_image_flush (image);
|
2001-06-26 20:09:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-10-18 19:29:58 +08:00
|
|
|
select_shrink_callback (GtkWidget *widget,
|
|
|
|
gdouble size,
|
|
|
|
GimpUnit unit,
|
|
|
|
gpointer data)
|
2001-06-26 20:09:43 +08:00
|
|
|
{
|
2016-08-26 21:43:25 +08:00
|
|
|
GimpImage *image = GIMP_IMAGE (data);
|
|
|
|
GimpDialogConfig *config = GIMP_DIALOG_CONFIG (image->gimp->config);
|
|
|
|
GtkWidget *button;
|
|
|
|
gint radius_x;
|
|
|
|
gint radius_y;
|
|
|
|
|
|
|
|
button = g_object_get_data (G_OBJECT (widget), "edge-lock-toggle");
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2016-08-26 21:43:25 +08:00
|
|
|
g_object_set (config,
|
|
|
|
"selection-shrink-radius", size,
|
|
|
|
"selection-shrink-edge-lock",
|
|
|
|
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)),
|
|
|
|
NULL);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2016-08-26 21:43:25 +08:00
|
|
|
radius_x = ROUND (config->selection_shrink_radius);
|
|
|
|
radius_y = ROUND (config->selection_shrink_radius);
|
2001-06-26 20:09:43 +08:00
|
|
|
|
|
|
|
if (unit != GIMP_UNIT_PIXEL)
|
|
|
|
{
|
2007-12-27 01:33:41 +08:00
|
|
|
gdouble xres;
|
|
|
|
gdouble yres;
|
2001-06-26 20:09:43 +08:00
|
|
|
gdouble factor;
|
|
|
|
|
2007-12-27 01:33:41 +08:00
|
|
|
gimp_image_get_resolution (image, &xres, &yres);
|
|
|
|
|
|
|
|
factor = (MAX (xres, yres) /
|
|
|
|
MIN (xres, yres));
|
2001-06-26 20:09:43 +08:00
|
|
|
|
2007-12-27 01:33:41 +08:00
|
|
|
if (xres == MIN (xres, yres))
|
2004-05-25 22:37:02 +08:00
|
|
|
radius_y *= factor;
|
2001-06-26 20:09:43 +08:00
|
|
|
else
|
2004-05-25 22:37:02 +08:00
|
|
|
radius_x *= factor;
|
2001-06-26 20:09:43 +08:00
|
|
|
}
|
|
|
|
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_channel_shrink (gimp_image_get_mask (image), radius_x, radius_y,
|
2016-08-26 21:43:25 +08:00
|
|
|
config->selection_shrink_edge_lock,
|
|
|
|
TRUE);
|
2006-03-29 01:08:36 +08:00
|
|
|
gimp_image_flush (image);
|
2001-06-26 20:09:43 +08:00
|
|
|
}
|
2016-09-27 06:00:39 +08:00
|
|
|
|
|
|
|
static void
|
|
|
|
select_fill_callback (GtkWidget *dialog,
|
|
|
|
GimpItem *item,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
GimpContext *context,
|
|
|
|
GimpFillOptions *options,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GimpDialogConfig *config = GIMP_DIALOG_CONFIG (context->gimp->config);
|
|
|
|
GimpImage *image = gimp_item_get_image (item);
|
|
|
|
GError *error = NULL;
|
|
|
|
|
|
|
|
gimp_config_sync (G_OBJECT (options),
|
|
|
|
G_OBJECT (config->fill_options), 0);
|
|
|
|
|
|
|
|
if (! gimp_item_fill (item, drawable, options, TRUE, NULL, &error))
|
|
|
|
{
|
|
|
|
gimp_message_literal (context->gimp,
|
|
|
|
G_OBJECT (dialog),
|
|
|
|
GIMP_MESSAGE_WARNING,
|
|
|
|
error ? error->message : "NULL");
|
|
|
|
|
|
|
|
g_clear_error (&error);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
gimp_image_flush (image);
|
|
|
|
|
|
|
|
gtk_widget_destroy (dialog);
|
|
|
|
}
|
2016-09-27 17:15:52 +08:00
|
|
|
|
|
|
|
static void
|
|
|
|
select_stroke_callback (GtkWidget *dialog,
|
|
|
|
GimpItem *item,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
GimpContext *context,
|
|
|
|
GimpStrokeOptions *options,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GimpDialogConfig *config = GIMP_DIALOG_CONFIG (context->gimp->config);
|
|
|
|
GimpImage *image = gimp_item_get_image (item);
|
|
|
|
GError *error = NULL;
|
|
|
|
|
|
|
|
gimp_config_sync (G_OBJECT (options),
|
|
|
|
G_OBJECT (config->stroke_options), 0);
|
|
|
|
|
|
|
|
if (! gimp_item_stroke (item, drawable, context, options, NULL,
|
|
|
|
TRUE, NULL, &error))
|
|
|
|
{
|
|
|
|
gimp_message_literal (context->gimp,
|
|
|
|
G_OBJECT (dialog),
|
|
|
|
GIMP_MESSAGE_WARNING,
|
|
|
|
error ? error->message : "NULL");
|
|
|
|
|
|
|
|
g_clear_error (&error);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
gimp_image_flush (image);
|
|
|
|
|
|
|
|
gtk_widget_destroy (dialog);
|
|
|
|
}
|