|
Krita Source Code Documentation
|
Go to the source code of this file.
Functions | |
| template<typename CSTraits > | |
| static void | fillGrayBrushWithColorPreserveLightnessRGB (quint8 *pixels, const QRgb *brush, quint8 *brushColor, qreal strength, qint32 nPixels) |
| template<typename CSTraits > | |
| static void | modulateLightnessByGrayBrushRGB (quint8 *pixels, const QRgb *brush, qreal strength, qint32 nPixels) |
|
inlinestatic |
Lightness mixing algorithm is developed by Peter Schatz voron.nosp@m.we13.nosp@m.@gmai.nosp@m.l.co.nosp@m.m
We use a formula f(x) where f(0) = 0, f(1) = 1, and f(.5) = z, where z is the lightness of the brush color. This can’t be linear unless the color chosen is also .5. So we use a quadratic equation:
f(x) = ax^2 + b^x +c 0,0 -> 0 = a0^2 + b0 + c -> c = 0 1,1 -> 1 = a1^2 +b1 + c -> 1 = a + b + 0 -> a = 1 - b .5,z -> z = a*.5^2 + b*.5 + c -> z = = a/4 + b/2 + 0 -> z = = 1/4 - b/4 + b/2 -> z = 1/4 + b/4 -> b = 4z - 1
f(x) = (1 - (4z - 1)) * x^2 + (4z - 1) * x
Definition at line 15 of file KoColorSpacePreserveLightnessUtils.h.
References pow2(), and KoColorSpaceMaths< _T, _Tdst >::scaleToA().
|
inlinestatic |
Lightness mixing algorithm is developed by Peter Schatz voron.nosp@m.we13.nosp@m.@gmai.nosp@m.l.co.nosp@m.m
We use a formula f(x) where f(0) = 0, f(1) = 1, and f(.5) = z, where z is the lightness of the brush color. This can’t be linear unless the color chosen is also .5. So we use a quadratic equation:
f(x) = ax^2 + b^x +c 0,0 -> 0 = a0^2 + b0 + c -> c = 0 1,1 -> 1 = a1^2 +b1 + c -> 1 = a + b + 0 -> a = 1 - b .5,z -> z = a*.5^2 + b*.5 + c -> z = = a/4 + b/2 + 0 -> z = = 1/4 - b/4 + b/2 -> z = 1/4 + b/4 -> b = 4z - 1
f(x) = (1 - (4z - 1)) * x^2 + (4z - 1) * x
Definition at line 70 of file KoColorSpacePreserveLightnessUtils.h.
References pow2(), and KoColorSpaceMaths< _T, _Tdst >::scaleToA().