commit f3500e03ae6410248524975336749eacc6fc9cc0
Author: Koji Yokota <[email protected]>
Date:   Thu Jun 11 19:16:25 2026 +0900

    Fix the model of mixing two alpha values
    
    At least,
       1) mixing two transparents should be transparent and
       2) mixing two opaques should be opaque
---
 src/frontends/qt/ColorCache.cpp | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/frontends/qt/ColorCache.cpp b/src/frontends/qt/ColorCache.cpp
index 0949c2f3da..135c2f362a 100644
--- a/src/frontends/qt/ColorCache.cpp
+++ b/src/frontends/qt/ColorCache.cpp
@@ -132,16 +132,18 @@ ColorPair ColorCache::getAll(Color const & color, bool 
syscolors) const
                                merge_colors.first.toRgb().green()) / 2,
                               (base_colors.first.toRgb().blue() +
                                merge_colors.first.toRgb().blue()) / 2,
-                              (base_colors.first.toRgb().alpha() +
-                               merge_colors.first.toRgb().alpha()) / 2),
+                              std::round(
+                                  (1 - (1 - 
base_colors.first.toRgb().alphaF()) *
+                                       (1 - 
merge_colors.first.toRgb().alphaF())) * 255)),
                        QColor((base_colors.second.toRgb().red() +
                                merge_colors.second.toRgb().red()) / 2,
                               (base_colors.second.toRgb().green() +
                                merge_colors.second.toRgb().green()) / 2,
                               (base_colors.second.toRgb().blue() +
                                merge_colors.second.toRgb().blue()) / 2,
-                              (base_colors.second.toRgb().alpha() +
-                               merge_colors.second.toRgb().alpha()) / 2),
+                               std::round(
+                                  (1 - (1 - 
base_colors.second.toRgb().alphaF()) *
+                                       (1 - 
merge_colors.second.toRgb().alphaF())) * 255)),
                };
        }
        // used by branches
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to