Krita Source Code Documentation
Loading...
Searching...
No Matches
Arithmetic Namespace Reference

Functions

template<class T >
KoColorSpaceMathsTraits< T >::compositetype and (T a, T b)
 
template<class T >
blend (T src, T srcAlpha, T dst, T dstAlpha, T cfValue)
 
template<class T >
clamp (typename KoColorSpaceMathsTraits< T >::compositetype a)
 
template<class T >
clampChannelToSDR (T a)
 
template<class T >
clampChannelToSDRBottom (T a)
 
template<class T >
clampToSDR (typename KoColorSpaceMathsTraits< T >::compositetype a)
 
template<class T >
clampToSDRBottom (typename KoColorSpaceMathsTraits< T >::compositetype a)
 
template<class T >
clampToSDRTop (typename KoColorSpaceMathsTraits< T >::compositetype a)
 
template<class T >
KoColorSpaceMathsTraits< T >::compositetype div (T a, T b)
 
template<class T , typename composite_type = typename KoColorSpaceMathsTraits<T>::compositetype>
composite_type divideInCompositeSpace (composite_type a, composite_type b)
 
template<class T >
epsilon ()
 
template<class T >
halfValue ()
 
template<class T >
inv (T a)
 
template<typename T >
static bool isHalfValueFuzzy (T v)
 
template<typename T >
static bool isUnitValueClampedFuzzy (T v)
 
template<typename T >
bool isUnitValueClampedStrict (T value)
 
template<typename T >
static bool isUnitValueFuzzy (T v)
 
template<typename T >
bool isUnitValueStrict (T value)
 
template<typename T >
isUnsafeAsDivisor (T value)
 
template<typename T >
static bool isZeroValueClampedFuzzy (T v)
 
template<typename T >
bool isZeroValueClampedStrict (T value)
 
template<typename T >
static bool isZeroValueFuzzy (T v)
 
template<typename T >
bool isZeroValueStrict (T value)
 
template<class T >
lerp (T a, T b, T alpha)
 
template<class T >
max (T a, T b, T c)
 
template<class T >
min (T a, T b, T c)
 
template<class T >
KoColorSpaceMathsTraits< T >::compositetype mod (T a, T b)
 
template<class T >
mul (T a, T b)
 
template<class T >
mul (T a, T b, T c)
 
template<class T , typename composite_type = typename KoColorSpaceMathsTraits<T>::compositetype>
composite_type multiplyInCompositeSpace (composite_type a, composite_type b)
 
template<class T >
KoColorSpaceMathsTraits< T >::compositetype or (T a, T b)
 
template<class TRet , class T >
TRet scale (T a)
 
template<class T >
unionShapeOpacity (T a, T b)
 
template<class T >
unitValue ()
 
template<class T >
KoColorSpaceMathsTraits< T >::compositetype xor (T a, T b)
 
template<class T >
zeroValue ()
 

Variables

static const qreal pi = 3.14159265358979323846
 

Function Documentation

◆ and()

template<class T >
KoColorSpaceMathsTraits< T >::compositetype Arithmetic::and ( T a,
T b )
inline

Definition at line 761 of file KoColorSpaceMaths.h.

761{ return KoColorSpaceMaths<T>::and(a, b); }
static dst_compositetype and(_T a, _Tdst b)

References KoColorSpaceMaths< _T, _Tdst >::and().

◆ blend()

template<class T >
T Arithmetic::blend ( T src,
T srcAlpha,
T dst,
T dstAlpha,
T cfValue )
inline

Definition at line 892 of file KoColorSpaceMaths.h.

892 {
893 return mul(inv(srcAlpha), dstAlpha, dst) + mul(inv(dstAlpha), srcAlpha, src) + mul(dstAlpha, srcAlpha, cfValue);
894 }
T mul(T a, T b)

References inv(), and mul().

◆ clamp()

template<class T >
T Arithmetic::clamp ( typename KoColorSpaceMathsTraits< T >::compositetype a)
inline

Definition at line 768 of file KoColorSpaceMaths.h.

768 {
770 }
static dst_compositetype clamp(dst_compositetype val)

References KoColorSpaceMaths< _T, _Tdst >::clamp().

◆ clampChannelToSDR()

template<class T >
T Arithmetic::clampChannelToSDR ( T a)
inline

Definition at line 773 of file KoColorSpaceMaths.h.

773 {
775 }
static _T clampChannelToSDR(_T val)

References KoColorSpaceMaths< _T, _Tdst >::clampChannelToSDR().

◆ clampChannelToSDRBottom()

template<class T >
T Arithmetic::clampChannelToSDRBottom ( T a)
inline

◆ clampToSDR()

template<class T >
T Arithmetic::clampToSDR ( typename KoColorSpaceMathsTraits< T >::compositetype a)
inline

Definition at line 783 of file KoColorSpaceMaths.h.

783 {
785 }
static dst_compositetype clampToSDR(dst_compositetype val)

References KoColorSpaceMaths< _T, _Tdst >::clampToSDR().

◆ clampToSDRBottom()

template<class T >
T Arithmetic::clampToSDRBottom ( typename KoColorSpaceMathsTraits< T >::compositetype a)
inline

Definition at line 793 of file KoColorSpaceMaths.h.

793 {
795 }
static dst_compositetype clampToSDRBottom(dst_compositetype val)

References KoColorSpaceMaths< _T, _Tdst >::clampToSDRBottom().

◆ clampToSDRTop()

template<class T >
T Arithmetic::clampToSDRTop ( typename KoColorSpaceMathsTraits< T >::compositetype a)
inline

Definition at line 788 of file KoColorSpaceMaths.h.

788 {
790 }
static dst_compositetype clampToSDRTop(dst_compositetype val)

References KoColorSpaceMaths< _T, _Tdst >::clampToSDRTop().

◆ div()

template<class T >
KoColorSpaceMathsTraits< T >::compositetype Arithmetic::div ( T a,
T b )
inline

Definition at line 753 of file KoColorSpaceMaths.h.

753{ return KoColorSpaceMaths<T>::divide(a, b); }
static dst_compositetype divide(_T a, _Tdst b)

References KoColorSpaceMaths< _T, _Tdst >::divide().

◆ divideInCompositeSpace()

template<class T , typename composite_type = typename KoColorSpaceMathsTraits<T>::compositetype>
composite_type Arithmetic::divideInCompositeSpace ( composite_type a,
composite_type b )
inline

Definition at line 798 of file KoColorSpaceMaths.h.

798 {
800 }
static dst_compositetype divideInCompositeSpace(dst_compositetype a, dst_compositetype b)

References KoColorSpaceMaths< _T, _Tdst >::divideInCompositeSpace().

◆ epsilon()

template<class T >
T Arithmetic::epsilon ( )
inline

◆ halfValue()

template<class T >
T Arithmetic::halfValue ( )
inline

Definition at line 880 of file KoColorSpaceMaths.h.

◆ inv()

template<class T >
T Arithmetic::inv ( T a)
inline

Definition at line 743 of file KoColorSpaceMaths.h.

743{ return KoColorSpaceMaths<T>::invert(a); }
static _T invert(_T a)

References KoColorSpaceMaths< _T, _Tdst >::invert().

◆ isHalfValueFuzzy()

template<typename T >
static bool Arithmetic::isHalfValueFuzzy ( T v)
inlinestatic

Definition at line 832 of file KoColorSpaceMaths.h.

833 {
835 }
qreal v
static bool isHalfValueFuzzy(_T v)

References KoColorSpaceMaths< _T, _Tdst >::isHalfValueFuzzy(), and v.

◆ isUnitValueClampedFuzzy()

template<typename T >
static bool Arithmetic::isUnitValueClampedFuzzy ( T v)
inlinestatic

Definition at line 826 of file KoColorSpaceMaths.h.

827 {
829 }
static bool isUnitValueClampedFuzzy(_T v)

References KoColorSpaceMaths< _T, _Tdst >::isUnitValueClampedFuzzy(), and v.

◆ isUnitValueClampedStrict()

template<typename T >
bool Arithmetic::isUnitValueClampedStrict ( T value)
inline

Definition at line 847 of file KoColorSpaceMaths.h.

847 {
848 if constexpr (std::numeric_limits<T>::is_integer) {
850 } else {
852 }
853 }
float value(const T *src, size_t ch)

References value().

◆ isUnitValueFuzzy()

template<typename T >
static bool Arithmetic::isUnitValueFuzzy ( T v)
inlinestatic

Definition at line 814 of file KoColorSpaceMaths.h.

815 {
817 }
static bool isUnitValueFuzzy(_T value)

References KoColorSpaceMaths< _T, _Tdst >::isUnitValueFuzzy(), and v.

◆ isUnitValueStrict()

template<typename T >
bool Arithmetic::isUnitValueStrict ( T value)
inline

Definition at line 838 of file KoColorSpaceMaths.h.

838 {
840 }

References value().

◆ isUnsafeAsDivisor()

template<typename T >
T Arithmetic::isUnsafeAsDivisor ( T value)
inline

Definition at line 904 of file KoColorSpaceMaths.h.

904 {
906 }
static _T isUnsafeAsDivisor(_T value)

References KoColorSpaceMaths< _T, _Tdst >::isUnsafeAsDivisor(), and value().

◆ isZeroValueClampedFuzzy()

template<typename T >
static bool Arithmetic::isZeroValueClampedFuzzy ( T v)
inlinestatic

Definition at line 820 of file KoColorSpaceMaths.h.

821 {
823 }
static bool isZeroValueClampedFuzzy(_T v)

References KoColorSpaceMaths< _T, _Tdst >::isZeroValueClampedFuzzy(), and v.

◆ isZeroValueClampedStrict()

template<typename T >
bool Arithmetic::isZeroValueClampedStrict ( T value)
inline

Definition at line 855 of file KoColorSpaceMaths.h.

855 {
856 if constexpr (std::numeric_limits<T>::is_integer) {
858 } else {
859 return value <= KoColorSpaceMathsTraits<T>::zeroValue;
860 }
861 }

References value().

◆ isZeroValueFuzzy()

template<typename T >
static bool Arithmetic::isZeroValueFuzzy ( T v)
inlinestatic

Definition at line 808 of file KoColorSpaceMaths.h.

809 {
811 }
static bool isZeroValueFuzzy(_T value)

References KoColorSpaceMaths< _T, _Tdst >::isZeroValueFuzzy(), and v.

◆ isZeroValueStrict()

template<typename T >
bool Arithmetic::isZeroValueStrict ( T value)
inline

Definition at line 842 of file KoColorSpaceMaths.h.

842 {
844 }

References value().

◆ lerp()

template<class T >
T Arithmetic::lerp ( T a,
T b,
T alpha )
inline

Definition at line 746 of file KoColorSpaceMaths.h.

746{ return KoColorSpaceMaths<T>::blend(b, a, alpha); }
static _T blend(_T a, _T b, _T alpha)

References KoColorSpaceMaths< _T, _Tdst >::blend().

◆ max()

template<class T >
T Arithmetic::max ( T a,
T b,
T c )
inline

Definition at line 871 of file KoColorSpaceMaths.h.

871 {
872 b = (a > b) ? a : b;
873 return (b > c) ? b : c;
874 }

◆ min()

template<class T >
T Arithmetic::min ( T a,
T b,
T c )
inline

Definition at line 865 of file KoColorSpaceMaths.h.

865 {
866 b = (a < b) ? a : b;
867 return (b < c) ? b : c;
868 }

◆ mod()

template<class T >
KoColorSpaceMathsTraits< T >::compositetype Arithmetic::mod ( T a,
T b )
inline

Definition at line 901 of file KoColorSpaceMaths.h.

901{ return KoColorSpaceMaths<T>::modulus(a, b); }
static dst_compositetype modulus(_T a, _Tdst b)

References KoColorSpaceMaths< _T, _Tdst >::modulus().

◆ mul() [1/2]

template<class T >
T Arithmetic::mul ( T a,
T b )
inline

Definition at line 725 of file KoColorSpaceMaths.h.

725{ return KoColorSpaceMaths<T>::multiply(a, b); }
static _Tdst multiply(_T a, _Tdst b)

References KoColorSpaceMaths< _T, _Tdst >::multiply().

◆ mul() [2/2]

template<class T >
T Arithmetic::mul ( T a,
T b,
T c )
inline

Definition at line 728 of file KoColorSpaceMaths.h.

728{ return KoColorSpaceMaths<T>::multiply(a, b, c); }

References KoColorSpaceMaths< _T, _Tdst >::multiply().

◆ multiplyInCompositeSpace()

template<class T , typename composite_type = typename KoColorSpaceMathsTraits<T>::compositetype>
composite_type Arithmetic::multiplyInCompositeSpace ( composite_type a,
composite_type b )
inline

Definition at line 803 of file KoColorSpaceMaths.h.

803 {
805 }
static dst_compositetype multiplyInCompositeSpace(dst_compositetype a, dst_compositetype b)

References KoColorSpaceMaths< _T, _Tdst >::multiplyInCompositeSpace().

◆ or()

template<class T >
KoColorSpaceMathsTraits< T >::compositetype Arithmetic::or ( T a,
T b )
inline

Definition at line 765 of file KoColorSpaceMaths.h.

765{ return KoColorSpaceMaths<T>::or(a, b); }
static dst_compositetype or(_T a, _Tdst b)

References KoColorSpaceMaths< _T, _Tdst >::or().

◆ scale()

template<class TRet , class T >
TRet Arithmetic::scale ( T a)
inline

Definition at line 749 of file KoColorSpaceMaths.h.

static _Tdst scaleToA(_T a)

References KoColorSpaceMaths< _T, _Tdst >::scaleToA().

◆ unionShapeOpacity()

template<class T >
T Arithmetic::unionShapeOpacity ( T a,
T b )
inline

Definition at line 886 of file KoColorSpaceMaths.h.

886 {
887 typedef typename KoColorSpaceMathsTraits<T>::compositetype composite_type;
888 return T(composite_type(a) + b - mul(a,b));
889 }

References mul().

◆ unitValue()

template<class T >
T Arithmetic::unitValue ( )
inline

Definition at line 883 of file KoColorSpaceMaths.h.

◆ xor()

template<class T >
KoColorSpaceMathsTraits< T >::compositetype Arithmetic::xor ( T a,
T b )
inline

Definition at line 757 of file KoColorSpaceMaths.h.

757{ return KoColorSpaceMaths<T>::xor(a, b); }
static dst_compositetype xor(_T a, _Tdst b)

References KoColorSpaceMaths< _T, _Tdst >::xor().

◆ zeroValue()

template<class T >
T Arithmetic::zeroValue ( )
inline

Definition at line 877 of file KoColorSpaceMaths.h.

Variable Documentation

◆ pi

const qreal Arithmetic::pi = 3.14159265358979323846
static

Definition at line 722 of file KoColorSpaceMaths.h.