[gimp] Issue #4354 - When using color to fade dynamics and gradient with transparency ...



commit 9fe33702fb051922072831b23b432040ac2225ec
Author: Ell <ell_se yahoo com>
Date:   Thu Jan 9 22:26:35 2020 +0200

    Issue #4354 - When using color to fade dynamics and gradient with transparency ...
    
    ... brush does not have transparency
    
    In the PAINT_MASK_TO_COMP_MASK paintcore-loops algorithm, used when
    painting incrementally, multiply the paint mask values by the paint
    opacity.  Previously, the paint opacity was ignored, breaking
    various dynamics affecting the opacity.

 app/paint/gimppaintcore-loops.cc | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/app/paint/gimppaintcore-loops.cc b/app/paint/gimppaintcore-loops.cc
index f17f8c42eb..973bb550c5 100644
--- a/app/paint/gimppaintcore-loops.cc
+++ b/app/paint/gimppaintcore-loops.cc
@@ -1725,7 +1725,8 @@ struct PaintMaskToCompMask : Base
         for (x = 0; x < rect->width; x++)
           {
             comp_mask_pixel[0] = value_to_float (mask_pixel[0]) *
-                                 state->mask_pixel[0];
+                                 state->mask_pixel[0]           *
+                                 params->paint_opacity;
 
             comp_mask_pixel   += 1;
             mask_pixel        += 1;
@@ -1736,7 +1737,8 @@ struct PaintMaskToCompMask : Base
       {
         for (x = 0; x < rect->width; x++)
           {
-            comp_mask_pixel[0] = value_to_float (mask_pixel[0]);
+            comp_mask_pixel[0] = value_to_float (mask_pixel[0]) *
+                                 params->paint_opacity;
 
             comp_mask_pixel += 1;
             mask_pixel      += 1;
@@ -1843,7 +1845,10 @@ struct DispatchPaintMaskToCompMask
           {
             using NewAlgorithm = typename decltype (algorithm)::type;
 
-            Dispatch<NewAlgorithm> () (visitor, params, algorithms, algorithm);
+            if (params->paint_opacity == GIMP_OPACITY_OPAQUE)
+              Dispatch<NewAlgorithm> () (visitor, params, algorithms, algorithm);
+            else
+              DispatchIndirect       () (visitor, params, algorithms, algorithm);
           },
           params, algorithms, algorithm,
           dispatch_paint_mask,


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