[gimp] app: Paint Select tool, reflect changes applied to the gegl operation...



commit 9e391bc3b66320c00860b362a01bb23bd77388e7
Author: Thomas Manni <thomas manni free fr>
Date:   Tue Nov 24 18:49:45 2020 +0100

    app: Paint Select tool, reflect changes applied to the gegl operation...
    
    ...related to fluctuations removal.

 app/tools/gimppaintselecttool.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/app/tools/gimppaintselecttool.c b/app/tools/gimppaintselecttool.c
index e154563bb5..6a60000a2f 100644
--- a/app/tools/gimppaintselecttool.c
+++ b/app/tools/gimppaintselecttool.c
@@ -113,7 +113,8 @@ static void   gimp_paint_select_tool_cursor_update       (GimpTool         *tool
 static void   gimp_paint_select_tool_draw                (GimpDrawTool     *draw_tool);
 
 static void   gimp_paint_select_tool_halt                 (GimpPaintSelectTool *ps_tool);
-static void   gimp_paint_select_tool_update_image_mask   (GimpPaintSelectTool *ps_tool);
+static void   gimp_paint_select_tool_update_image_mask   (GimpPaintSelectTool *ps_tool,
+                                                          GimpPaintSelectMode  mode);
 static void   gimp_paint_select_tool_init_buffers        (GimpPaintSelectTool  *ps_tool,
                                                           GimpImage            *image,
                                                           GimpDrawable         *drawable);
@@ -432,7 +433,7 @@ gimp_paint_select_tool_motion (GimpTool         *tool,
               g_printerr ("processing graph takes %.3f s\n", g_timer_elapsed (timer, NULL));
               g_timer_destroy (timer);
 
-              gimp_paint_select_tool_update_image_mask (ps_tool);
+              gimp_paint_select_tool_update_image_mask (ps_tool, options->mode);
             }
 
           gimp_tool_control_activate (tool->control);
@@ -529,20 +530,27 @@ gimp_paint_select_tool_halt (GimpPaintSelectTool *ps_tool)
 }
 
 static void
-gimp_paint_select_tool_update_image_mask (GimpPaintSelectTool *ps_tool)
+gimp_paint_select_tool_update_image_mask (GimpPaintSelectTool *ps_tool,
+                                          GimpPaintSelectMode  mode)
 {
   GimpTool  *tool = GIMP_TOOL (ps_tool);
+  GimpChannelOps op;
 
   if (tool->display)
     {
       GimpImage *image = gimp_display_get_image (tool->display);
 
+      if (mode == GIMP_PAINT_SELECT_MODE_ADD)
+        op = GIMP_CHANNEL_OP_ADD;
+      else
+        op = GIMP_CHANNEL_OP_SUBTRACT;
+
       gimp_channel_select_buffer (gimp_image_get_mask (image),
                                   C_("command", "Paint Select"),
                                   ps_tool->result_mask,
                                   0, /* x offset */
                                   0, /* y offset */
-                                  GIMP_CHANNEL_OP_REPLACE,
+                                  op,
                                   FALSE,
                                   0,
                                   0);


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