Add anim::with_alpha helper.

This commit is contained in:
John Preston 2024-01-05 11:25:16 +04:00
parent 30c5dfe6f6
commit 30dc9667ec

View file

@ -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; 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 <int N> template <int N>
QPainterPath interpolate(QPointF (&from)[N], QPointF (&to)[N], float64 k) { QPainterPath interpolate(QPointF (&from)[N], QPointF (&to)[N], float64 k) {
static_assert(N > 1, "Wrong points count in path!"); static_assert(N > 1, "Wrong points count in path!");