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



commit 2665a6c7a6a322f3728e58848dc9062c74c9dd11
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.

 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 de1576812b..3798baf0f6 100644
--- a/app/tools/gimpfiltertool.c
+++ b/app/tools/gimpfiltertool.c
@@ -810,7 +810,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)
@@ -1120,7 +1122,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_gamma_hack (filter_tool->filter,
@@ -1158,7 +1162,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]