Fluent2: Don't flatten border colors to a color without alpha value

This commit is contained in:
Peter Hartmann 2023-07-07 16:09:11 +02:00
parent b3c7eb7412
commit b0a7f2ad19
1 changed files with 3 additions and 10 deletions

View File

@ -139,18 +139,11 @@ namespace
return qRgba( value, value, value, qRound( opacity * 255 ) ); return qRgba( value, value, value, qRound( opacity * 255 ) );
} }
inline constexpr QRgb rgbFlattened( QRgb foreground, QRgb background ) inline QRgb rgbFlattened( QRgb foreground, QRgb background )
{ {
//Q_ASSERT( qAlpha( background ) == 255 ); const auto alpha = qAlpha( foreground ) / 255.0;
const auto r2 = qAlpha( foreground ) / 255.0; return QskRgb::interpolated( background, foreground, alpha );
const auto r1 = 1.0 - r2;
const auto r = qRound( r1 * qRed( background ) + r2 * qRed( foreground ) );
const auto g = qRound( r1 * qGreen( background ) + r2 * qGreen( foreground ) );
const auto b = qRound( r1 * qBlue( background ) + r2 * qBlue( foreground ) );
return qRgb( r, g, b );
} }
inline constexpr QRgb rgbSolid( QRgb foreground, QRgb background ) inline constexpr QRgb rgbSolid( QRgb foreground, QRgb background )