From 30dc9667ec3513559af468f695ce4b384f451a79 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 5 Jan 2024 11:25:16 +0400 Subject: [PATCH] Add anim::with_alpha helper. --- ui/effects/animation_value.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ui/effects/animation_value.h b/ui/effects/animation_value.h index dee83eb..593432e 100644 --- a/ui/effects/animation_value.h +++ b/ui/effects/animation_value.h @@ -322,6 +322,11 @@ TG_FORCE_INLINE QBrush brush(style::color a, style::color b, float64 b_ratio) { return (b_ratio > 0) ? ((b_ratio < 1) ? brush(a->c, b->c, b_ratio) : b) : a; } +TG_FORCE_INLINE QColor with_alpha(QColor color, float64 alpha) { + color.setAlphaF(color.alphaF() * alpha); + return color; +} + template QPainterPath interpolate(QPointF (&from)[N], QPointF (&to)[N], float64 k) { static_assert(N > 1, "Wrong points count in path!");