[gimp] app: GimpFilterTool displays a "Sample merged" checkbox.



commit 578c078590ca8f7a1c687515ac14e4b042a2a36e
Author: Jehan <jehan girinstud io>
Date:   Sat Sep 26 12:40:54 2020 +0200

    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.

 app/tools/gimpcoloroptions.c       |  5 +++++
 app/tools/gimpcolorpickeroptions.c |  4 ----
 app/tools/gimpfiltertool.c         | 14 +++-----------
 3 files changed, 8 insertions(+), 15 deletions(-)
---
diff --git a/app/tools/gimpcoloroptions.c b/app/tools/gimpcoloroptions.c
index b5093dd04a..f98829ff33 100644
--- a/app/tools/gimpcoloroptions.c
+++ b/app/tools/gimpcoloroptions.c
@@ -149,6 +149,7 @@ gimp_color_options_gui (GimpToolOptions *tool_options)
 {
   GObject   *config = G_OBJECT (tool_options);
   GtkWidget *vbox   = gimp_tool_options_gui (tool_options);
+  GtkWidget *button;
   GtkWidget *frame;
   GtkWidget *scale;
 
@@ -160,5 +161,9 @@ gimp_color_options_gui (GimpToolOptions *tool_options)
                                          scale, NULL);
   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;
 }
diff --git a/app/tools/gimpcolorpickeroptions.c b/app/tools/gimpcolorpickeroptions.c
index 8a50491be1..ce75a71e6f 100644
--- a/app/tools/gimpcolorpickeroptions.c
+++ b/app/tools/gimpcolorpickeroptions.c
@@ -187,10 +187,6 @@ gimp_color_picker_options_gui (GimpToolOptions *tool_options)
   GdkModifierType  extend_mask = gimp_get_extend_selection_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  */
   str = g_strdup_printf (_("Pick Target  (%s)"),
                          gimp_get_mod_string (toggle_mask));
diff --git a/app/tools/gimpfiltertool.c b/app/tools/gimpfiltertool.c
index b5b576aa88..2595e90102 100644
--- a/app/tools/gimpfiltertool.c
+++ b/app/tools/gimpfiltertool.c
@@ -806,21 +806,13 @@ gimp_filter_tool_pick_color (GimpColorTool     *color_tool,
 {
   GimpTool       *tool        = GIMP_TOOL (color_tool);
   GimpFilterTool *filter_tool = GIMP_FILTER_TOOL (color_tool);
-  gint            off_x, off_y;
   gboolean        picked;
 
   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);
-
-  *sample_format = gimp_drawable_get_format (tool->drawables->data);
-
-  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);
+  picked = GIMP_COLOR_TOOL_CLASS (parent_class)->pick (color_tool, coords,
+                                                       display, sample_format,
+                                                       pixel, color);
 
   if (! picked && filter_tool->pick_abyss)
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]