Krita Source Code Documentation
Loading...
Searching...
No Matches
HSIType Struct Reference

#include <KoColorSpaceMaths.h>

Static Public Member Functions

template<class TReal >
static TReal getLightness (TReal r, TReal g, TReal b)
 
template<class TReal >
static TReal getSaturation (TReal r, TReal g, TReal b)
 

Static Public Attributes

static constexpr bool lightnessIsAverage = true
 

Detailed Description

Definition at line 924 of file KoColorSpaceMaths.h.

Member Function Documentation

◆ getLightness()

template<class TReal >
static TReal HSIType::getLightness ( TReal r,
TReal g,
TReal b )
inlinestatic

Definition at line 927 of file KoColorSpaceMaths.h.

927 {
928 return (r + g + b) * TReal(0.33333333333333333333); // (r + g + b) / 3.0
929 }

◆ getSaturation()

template<class TReal >
static TReal HSIType::getSaturation ( TReal r,
TReal g,
TReal b )
inlinestatic

Definition at line 932 of file KoColorSpaceMaths.h.

932 {
933 TReal max = Arithmetic::max(r, g, b);
934 TReal min = Arithmetic::min(r, g, b);
935 TReal chroma = max - min;
936
937 return (chroma > std::numeric_limits<TReal>::epsilon()) ?
938 (TReal(1.0) - min / getLightness(r, g, b)) : TReal(0.0);
939 }
T max(T a, T b, T c)
T min(T a, T b, T c)
constexpr std::enable_if< sizeof...(values)==0, size_t >::type max()
static TReal getLightness(TReal r, TReal g, TReal b)

References getLightness(), Arithmetic::max(), and Arithmetic::min().

Member Data Documentation

◆ lightnessIsAverage

constexpr bool HSIType::lightnessIsAverage = true
staticconstexpr

Definition at line 941 of file KoColorSpaceMaths.h.


The documentation for this struct was generated from the following file: