diff --git a/clients/oxygen/oxygenclient.cpp b/clients/oxygen/oxygenclient.cpp index ce79c459be..ab6da2ccd2 100644 --- a/clients/oxygen/oxygenclient.cpp +++ b/clients/oxygen/oxygenclient.cpp @@ -53,6 +53,31 @@ namespace Oxygen { p->drawEllipse(QRectF(point.x()-diameter/2, point.y()-diameter/2, diameter, diameter)); } + + //_________________________________________________________ + QColor reduceContrast(const QColor &c0, const QColor &c1, double t) + { + double s = KColorUtils::contrastRatio(c0, c1); + if (s < t) + return c1; + + double l = 0.0, h = 1.0; + double x = s, a; + QColor r = c1; + for (int maxiter = 16; maxiter; --maxiter) + { + + a = 0.5 * (l + h); + r = KColorUtils::mix(c0, c1, a); + x = KColorUtils::contrastRatio(c0, r); + + if (fabs(x - t) < 0.01) break; + if (x > t) h = a; + else l = a; + } + + return r; + } //___________________________________________ OxygenClient::OxygenClient(KDecorationBridge *b, OxygenFactory *f): @@ -184,31 +209,6 @@ namespace Oxygen } } - //_________________________________________________________ - QColor reduceContrast(const QColor &c0, const QColor &c1, double t) - { - double s = KColorUtils::contrastRatio(c0, c1); - if (s < t) - return c1; - - double l = 0.0, h = 1.0; - double x = s, a; - QColor r = c1; - for (int maxiter = 16; maxiter; --maxiter) - { - - a = 0.5 * (l + h); - r = KColorUtils::mix(c0, c1, a); - x = KColorUtils::contrastRatio(c0, r); - - if (fabs(x - t) < 0.01) break; - if (x > t) h = a; - else l = a; - } - - return r; - } - //_________________________________________________________ QRegion OxygenClient::calcMask( void ) const { diff --git a/clients/oxygen/oxygenclient.h b/clients/oxygen/oxygenclient.h index de41413d13..e868d0ef0c 100644 --- a/clients/oxygen/oxygenclient.h +++ b/clients/oxygen/oxygenclient.h @@ -298,6 +298,16 @@ namespace Oxygen }; + //!@name utility functions + //@{ + + // dot + void renderDot(QPainter*, const QPointF&, qreal ); + + // contrast + QColor reduceContrast(const QColor&, const QColor&, double t); + + //@} } // namespace Oxygen