app: GimpFilterTool displays a "Sample merged" checkbox.

In several GeglOperation filters, it is possible to pick a color. Up to
now, it was only possible to pick a color from the active layer (the one
you run the operation on). With this change, we can also pick in Sample
merged mode, same as Color Picker tool and other color tools.
This commit is contained in:
Jehan 2020-09-26 12:40:54 +02:00
parent 578e3b0bd9
commit 578c078590
3 changed files with 8 additions and 15 deletions

View File

@ -149,6 +149,7 @@ gimp_color_options_gui (GimpToolOptions *tool_options)
{ {
GObject *config = G_OBJECT (tool_options); GObject *config = G_OBJECT (tool_options);
GtkWidget *vbox = gimp_tool_options_gui (tool_options); GtkWidget *vbox = gimp_tool_options_gui (tool_options);
GtkWidget *button;
GtkWidget *frame; GtkWidget *frame;
GtkWidget *scale; GtkWidget *scale;
@ -160,5 +161,9 @@ gimp_color_options_gui (GimpToolOptions *tool_options)
scale, NULL); scale, NULL);
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
/* The Sample merged checkbox. */
button = gimp_prop_check_button_new (config, "sample-merged", NULL);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
return vbox; return vbox;
} }

View File

@ -187,10 +187,6 @@ gimp_color_picker_options_gui (GimpToolOptions *tool_options)
GdkModifierType extend_mask = gimp_get_extend_selection_mask (); GdkModifierType extend_mask = gimp_get_extend_selection_mask ();
GdkModifierType toggle_mask = gimp_get_toggle_behavior_mask (); GdkModifierType toggle_mask = gimp_get_toggle_behavior_mask ();
/* the sample merged toggle button */
button = gimp_prop_check_button_new (config, "sample-merged", NULL);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
/* the pick FG/BG frame */ /* the pick FG/BG frame */
str = g_strdup_printf (_("Pick Target (%s)"), str = g_strdup_printf (_("Pick Target (%s)"),
gimp_get_mod_string (toggle_mask)); gimp_get_mod_string (toggle_mask));

View File

@ -806,21 +806,13 @@ gimp_filter_tool_pick_color (GimpColorTool *color_tool,
{ {
GimpTool *tool = GIMP_TOOL (color_tool); GimpTool *tool = GIMP_TOOL (color_tool);
GimpFilterTool *filter_tool = GIMP_FILTER_TOOL (color_tool); GimpFilterTool *filter_tool = GIMP_FILTER_TOOL (color_tool);
gint off_x, off_y;
gboolean picked; gboolean picked;
g_return_val_if_fail (g_list_length (tool->drawables) == 1, FALSE); g_return_val_if_fail (g_list_length (tool->drawables) == 1, FALSE);
gimp_item_get_offset (GIMP_ITEM (tool->drawables->data), &off_x, &off_y); picked = GIMP_COLOR_TOOL_CLASS (parent_class)->pick (color_tool, coords,
display, sample_format,
*sample_format = gimp_drawable_get_format (tool->drawables->data); pixel, color);
picked = gimp_pickable_pick_color (GIMP_PICKABLE (tool->drawables->data),
coords->x - off_x,
coords->y - off_y,
color_tool->options->sample_average,
color_tool->options->average_radius,
pixel, color);
if (! picked && filter_tool->pick_abyss) if (! picked && filter_tool->pick_abyss)
{ {