[gimp/gimp-2-10] app: don't extend layers with no alpha channel when applying filters



commit b89ad56a3594d8caaa6056606304757369f9e804
Author: Ell <ell_se yahoo com>
Date:   Thu Oct 3 22:13:08 2019 +0300

    app: don't extend layers with no alpha channel when applying filters
    
    In GimpFilterTool, don't provide a clipping option for layers with
    no alpha channel, and always clip the result to the layer bounds,
    since the extended regions of the result usually require alpha to
    be meaningful.
    
    Similarly to last commit, the ideal solution would be to
    automatically add an alpha channel as necessary.
    
    (cherry picked from commit 4b58e178a5a4206cd84ae6402a967862897f14bb)

 app/tools/gimpfiltertool.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/app/tools/gimpfiltertool.c b/app/tools/gimpfiltertool.c
index a5ea14c138..9adfde08cc 100644
--- a/app/tools/gimpfiltertool.c
+++ b/app/tools/gimpfiltertool.c
@@ -821,7 +821,9 @@ gimp_filter_tool_options_notify (GimpTool         *tool,
     {
       gimp_drawable_filter_set_clip (filter_tool->filter,
                                      filter_options->clip ==
-                                     GIMP_TRANSFORM_RESIZE_CLIP);
+                                     GIMP_TRANSFORM_RESIZE_CLIP ||
+                                     ! gimp_drawable_has_alpha (
+                                         tool->drawable));
     }
   else if (! strcmp (pspec->name, "region") &&
            filter_tool->filter)
@@ -1137,7 +1139,9 @@ gimp_filter_tool_create_filter (GimpFilterTool *filter_tool)
 
   gimp_drawable_filter_set_clip          (filter_tool->filter,
                                           options->clip ==
-                                          GIMP_TRANSFORM_RESIZE_CLIP);
+                                          GIMP_TRANSFORM_RESIZE_CLIP ||
+                                          ! gimp_drawable_has_alpha (
+                                              tool->drawable));
   gimp_drawable_filter_set_region        (filter_tool->filter,
                                           options->region);
   gimp_drawable_filter_set_color_managed (filter_tool->filter,
@@ -1177,7 +1181,8 @@ gimp_filter_tool_update_dialog (GimpFilterTool *filter_tool)
           gtk_widget_set_visible (
             filter_tool->clip_combo,
             gimp_item_get_clip (GIMP_ITEM (tool->drawable), FALSE) == FALSE &&
-            ! gimp_gegl_node_is_point_operation (filter_tool->operation));
+            ! gimp_gegl_node_is_point_operation (filter_tool->operation)    &&
+            gimp_drawable_has_alpha (tool->drawable));
 
           gtk_widget_hide (filter_tool->region_combo);
         }


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