Commit 80ca67e4 authored by Thomas Hartmann's avatar Thomas Hartmann Committed by Alessandro Portale

StyleHelper: Fixing alphaBlendedColors

Change-Id: Ib2f5e37e213e221ecfcce876ed2f44013815ca46
Reviewed-by: Alessandro Portale's avatarAlessandro Portale <alessandro.portale@qt.io>
parent 4bdd1ffb
......@@ -66,14 +66,14 @@ QColor StyleHelper::mergedColors(const QColor &colorA, const QColor &colorB, int
QColor StyleHelper::alphaBlendedColors(const QColor &colorA, const QColor &colorB)
{
const QRgb base = colorA.rgba();
const QRgb overlay = colorB.rgba();
const qreal overlayIntensity = qAlpha(overlay) / 255.0;
return qRgba(
qMin(qRed(base) + qRound(qRed(overlay) * overlayIntensity), 0xff),
qMin(qGreen(base) + qRound(qGreen(overlay) * overlayIntensity), 0xff),
qMin(qBlue(base) + qRound(qBlue(overlay) * overlayIntensity), 0xff),
qMin(qAlpha(base) + qAlpha(overlay), 0xff));
const int alpha = colorB.alpha();
const int antiAlpha = 255 - alpha;
return QColor(
(colorA.red() * antiAlpha + colorB.red() * alpha) / 255,
(colorA.green() * antiAlpha + colorB.green() * alpha) / 255,
(colorA.blue() * antiAlpha + colorB.blue() * alpha) / 255
);
}
qreal StyleHelper::sidebarFontSize()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment