[gimp/gimp-2-10] app: GimpFilterTool displays a "Sample merged" checkbox.



commit df6e13a5607af46c1dd58334bca466bb866a8cdd
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.
    
    (cherry picked from commit 578c078590ca8f7a1c687515ac14e4b042a2a36e)

 app/tools/gimpcoloroptions.c       |  6 ++++++
 app/tools/gimpcolorpickeroptions.c |  5 -----
 app/tools/gimpfiltertool.c         | 15 +++------------
 3 files changed, 9 insertions(+), 17 deletions(-)
---
diff --git a/app/tools/gimpcoloroptions.c b/app/tools/gimpcoloroptions.c
index a698019308..62a543a9c6 100644
--- a/app/tools/gimpcoloroptions.c
+++ b/app/tools/gimpcoloroptions.c
@@ -148,6 +148,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,10 @@ gimp_color_options_gui (GimpToolOptions *tool_options)
   gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
   gtk_widget_show (frame);
 
+  /* 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);
+  gtk_widget_show (button);
+
   return vbox;
 }
diff --git a/app/tools/gimpcolorpickeroptions.c b/app/tools/gimpcolorpickeroptions.c
index 5305304dd9..f2ba08b3c8 100644
--- a/app/tools/gimpcolorpickeroptions.c
+++ b/app/tools/gimpcolorpickeroptions.c
@@ -186,11 +186,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);
-  gtk_widget_show (button);
-
   /*  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 e54aa514e4..2dbe0d60b8 100644
--- a/app/tools/gimpfiltertool.c
+++ b/app/tools/gimpfiltertool.c
@@ -789,21 +789,12 @@ gimp_filter_tool_pick_color (GimpColorTool     *color_tool,
                              gpointer           pixel,
                              GimpRGB           *color)
 {
-  GimpTool       *tool        = GIMP_TOOL (color_tool);
   GimpFilterTool *filter_tool = GIMP_FILTER_TOOL (color_tool);
-  gint            off_x, off_y;
   gboolean        picked;
 
-  gimp_item_get_offset (GIMP_ITEM (tool->drawable), &off_x, &off_y);
-
-  *sample_format = gimp_drawable_get_format (tool->drawable);
-
-  picked = gimp_pickable_pick_color (GIMP_PICKABLE (tool->drawable),
-                                     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]