app: in prop gui & co., allow picking outside drawable bounds
Add a boolean 'pick_abyss' parameter to GimpCreatePickerFunc. When this parameter is TRUE, the picker should pick outside the bounds of the drawable. Use FALSE for color pickers, and TRUE for position pickers.
This commit is contained in:
@ -216,7 +216,8 @@ gimp_colorize_tool_dialog (GimpFilterTool *filter_tool)
|
||||
button = gimp_filter_tool_add_color_picker (filter_tool,
|
||||
"colorize",
|
||||
GIMP_ICON_COLOR_PICKER_GRAY,
|
||||
_("Pick color from image"));
|
||||
_("Pick color from image"),
|
||||
/* pick_abyss = */ FALSE);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
}
|
||||
|
||||
@ -800,18 +800,36 @@ gimp_filter_tool_pick_color (GimpColorTool *color_tool,
|
||||
GimpRGB *color)
|
||||
{
|
||||
GimpFilterTool *filter_tool = GIMP_FILTER_TOOL (color_tool);
|
||||
gboolean pick_abyss;
|
||||
gint off_x, off_y;
|
||||
gboolean picked;
|
||||
|
||||
pick_abyss =
|
||||
GPOINTER_TO_INT (g_object_get_data (G_OBJECT (filter_tool->active_picker),
|
||||
"picker-pick-abyss"));
|
||||
|
||||
gimp_item_get_offset (GIMP_ITEM (filter_tool->drawable), &off_x, &off_y);
|
||||
|
||||
*sample_format = gimp_drawable_get_format (filter_tool->drawable);
|
||||
|
||||
return gimp_pickable_pick_color (GIMP_PICKABLE (filter_tool->drawable),
|
||||
x - off_x,
|
||||
y - off_y,
|
||||
color_tool->options->sample_average,
|
||||
color_tool->options->average_radius,
|
||||
pixel, color);
|
||||
picked = gimp_pickable_pick_color (GIMP_PICKABLE (filter_tool->drawable),
|
||||
x - off_x,
|
||||
y - off_y,
|
||||
color_tool->options->sample_average,
|
||||
color_tool->options->average_radius,
|
||||
pixel, color);
|
||||
|
||||
if (! picked && pick_abyss)
|
||||
{
|
||||
color->r = 0.0;
|
||||
color->g = 0.0;
|
||||
color->b = 0.0;
|
||||
color->a = 0.0;
|
||||
|
||||
picked = TRUE;
|
||||
}
|
||||
|
||||
return picked;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1555,7 +1573,8 @@ GtkWidget *
|
||||
gimp_filter_tool_add_color_picker (GimpFilterTool *filter_tool,
|
||||
gpointer identifier,
|
||||
const gchar *icon_name,
|
||||
const gchar *tooltip)
|
||||
const gchar *tooltip,
|
||||
gboolean pick_abyss)
|
||||
{
|
||||
GtkWidget *button;
|
||||
GtkWidget *image;
|
||||
@ -1575,7 +1594,10 @@ gimp_filter_tool_add_color_picker (GimpFilterTool *filter_tool,
|
||||
if (tooltip)
|
||||
gimp_help_set_help_data (button, tooltip, NULL);
|
||||
|
||||
g_object_set_data (G_OBJECT (button), "picker-identifier", identifier);
|
||||
g_object_set_data (G_OBJECT (button),
|
||||
"picker-identifier", identifier);
|
||||
g_object_set_data (G_OBJECT (button),
|
||||
"picker-pick-abyss", GINT_TO_POINTER (pick_abyss));
|
||||
|
||||
g_signal_connect (button, "toggled",
|
||||
G_CALLBACK (gimp_filter_tool_color_picker_toggled),
|
||||
|
||||
@ -127,7 +127,8 @@ GtkWidget * gimp_filter_tool_dialog_get_vbox (GimpFilterTool *filter_tool);
|
||||
GtkWidget * gimp_filter_tool_add_color_picker (GimpFilterTool *filter_tool,
|
||||
gpointer identifier,
|
||||
const gchar *icon_name,
|
||||
const gchar *tooltip);
|
||||
const gchar *tooltip,
|
||||
gboolean pick_abyss);
|
||||
|
||||
|
||||
#endif /* __GIMP_FILTER_TOOL_H__ */
|
||||
|
||||
@ -323,7 +323,8 @@ gimp_levels_tool_color_picker_new (GimpLevelsTool *tool,
|
||||
return gimp_filter_tool_add_color_picker (GIMP_FILTER_TOOL (tool),
|
||||
GUINT_TO_POINTER (value),
|
||||
icon_name,
|
||||
help);
|
||||
help,
|
||||
/* pick_abyss = */ FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@ -168,7 +168,8 @@ _gimp_prop_gui_new_generic (GObject *config,
|
||||
button = create_picker_func (picker_creator,
|
||||
pspec_name,
|
||||
GIMP_ICON_CURSOR,
|
||||
_("Pick coordinates from the image"));
|
||||
_("Pick coordinates from the image"),
|
||||
/* pick_abyss = */ TRUE);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
|
||||
@ -343,7 +343,8 @@ gimp_prop_widget_new_from_pspec (GObject *config,
|
||||
button = create_picker_func (picker_creator,
|
||||
pspec->name,
|
||||
GIMP_ICON_COLOR_PICKER_GRAY,
|
||||
_("Pick color from the image"));
|
||||
_("Pick color from the image"),
|
||||
/* pick_abyss = */ FALSE);
|
||||
gtk_box_pack_start (GTK_BOX (widget), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
}
|
||||
|
||||
@ -27,7 +27,8 @@
|
||||
typedef GtkWidget * (* GimpCreatePickerFunc) (gpointer creator,
|
||||
const gchar *property_name,
|
||||
const gchar *icon_name,
|
||||
const gchar *tooltip);
|
||||
const gchar *tooltip,
|
||||
gboolean pick_abyss);
|
||||
|
||||
GtkWidget * gimp_prop_widget_new (GObject *config,
|
||||
const gchar *property_name,
|
||||
|
||||
Reference in New Issue
Block a user