digiKam
|
Functions | |
qreal | contrastRatio (const QColor &c1, const QColor &c2) |
QColor | darken (const QColor &color, qreal ky=0.5, qreal kc=1.0) |
void | getHcy (const QColor &color, qreal *h, qreal *c, qreal *y, qreal *a=nullptr) |
QColor | lighten (const QColor &color, qreal ky=0.5, qreal kc=1.0) |
qreal | luma (const QColor &color) |
QColor | mix (const QColor &c1, const QColor &c2, qreal bias) |
QColor | overlayColors (const QColor &base, const QColor &paint, QPainter::CompositionMode comp) |
QColor | shade (const QColor &color, qreal ky, qreal kc=0.0) |
QColor | tint (const QColor &base, const QColor &color, qreal amount=0.3) |
qreal Digikam::ColorTools::contrastRatio | ( | const QColor & | c1, |
const QColor & | c2 | ||
) |
References luma().
QColor Digikam::ColorTools::darken | ( | const QColor & | color, |
qreal | ky = 0.5 , |
||
qreal | kc = 1.0 |
||
) |
Adjust the luma of a color by changing its distance from black.
Referenced by Digikam::SchemeManager::shade().
void Digikam::ColorTools::getHcy | ( | const QColor & | color, |
qreal * | h, | ||
qreal * | c, | ||
qreal * | y, | ||
qreal * | a = nullptr |
||
) |
Calculate hue, chroma and luma of a color in one call.
QColor Digikam::ColorTools::lighten | ( | const QColor & | color, |
qreal | ky = 0.5 , |
||
qreal | kc = 1.0 |
||
) |
Adjust the luma of a color by changing its distance from white.
qreal Digikam::ColorTools::luma | ( | const QColor & | color | ) |
Calculate the luma of a color. Luma is weighted sum of gamma-adjusted R'G'B' components of a color. The result is similar to qGray. The range is from 0.0 (black) to 1.0 (white).
Referenced by contrastRatio(), Digikam::SchemeManager::shade(), and tint().
QColor Digikam::ColorTools::mix | ( | const QColor & | c1, |
const QColor & | c2, | ||
qreal | bias | ||
) |
Blend two colors into a new color by linear combination.
QColor Digikam::ColorTools::overlayColors | ( | const QColor & | base, |
const QColor & | paint, | ||
QPainter::CompositionMode | comp | ||
) |
Blend two colors into a new color by painting the second color over the first using the specified composition mode.
base | the base color (alpha channel is ignored). |
paint | the color to be overlayed onto the base color. |
comp | the CompositionMode used to do the blending. |
QColor Digikam::ColorTools::shade | ( | const QColor & | color, |
qreal | ky, | ||
qreal | kc = 0.0 |
||
) |
Adjust the luma and chroma components of a color. The amount is added to the corresponding component.
Referenced by Digikam::SchemeManager::shade().
QColor Digikam::ColorTools::tint | ( | const QColor & | base, |
const QColor & | color, | ||
qreal | amount = 0.3 |
||
) |
Create a new color by tinting one color with another. This function is meant for creating additional colors withings the same class (background, foreground) from colors in a different class. Therefore when amount
is low, the luma of base
is mostly preserved, while the hue and chroma of color
is mostly inherited.
base | color to be tinted |
color | the color with which to tint |
amount | how strongly to tint the base; 0.0 gives base , 1.0 gives color |
References luma().