Krita Source Code Documentation
Loading...
Searching...
No Matches
KoColorSpaceMaths< _T, _Tdst > Class Template Reference

#include <KoColorSpaceMaths.h>

Public Member Functions

float blend (float a, float b, float alpha)
 
quint8 blend (quint8 a, quint8 b, quint8 c)
 
double clamp (double a)
 
float clamp (float a)
 
KoColorSpaceMathsTraits< quint16 >::compositetype divide (quint16 a, quint16 b)
 
KoColorSpaceMathsTraits< quint8 >::compositetype divide (quint8 a, quint8 b)
 
quint16 invert (quint16 a)
 
quint8 invert (quint8 a)
 
bool isHalfValueFuzzy (double value)
 
bool isHalfValueFuzzy (float value)
 
bool isUnitValueClampedFuzzy (double d)
 
bool isUnitValueClampedFuzzy (float f)
 
bool isUnitValueFuzzy (double value)
 
bool isUnitValueFuzzy (float value)
 
double isUnsafeAsDivisor (double value)
 
float isUnsafeAsDivisor (float value)
 
bool isZeroValueClampedFuzzy (double d)
 
bool isZeroValueClampedFuzzy (float f)
 
bool isZeroValueFuzzy (double value)
 
bool isZeroValueFuzzy (float value)
 
quint16 multiply (quint16 a, quint16 b)
 
quint8 multiply (quint8 a, quint8 b)
 
quint8 multiply (quint8 a, quint8 b, quint8 c)
 
quint8 scaleToA (double a)
 
quint16 scaleToA (double a)
 
float scaleToA (double a)
 
double scaleToA (float a)
 
quint16 scaleToA (float a)
 
quint8 scaleToA (float a)
 
float scaleToA (float a)
 
double scaleToA (quint16 a)
 
float scaleToA (quint16 a)
 
quint8 scaleToA (quint16 a)
 
quint16 scaleToA (quint16 a)
 
double scaleToA (quint8 a)
 
float scaleToA (quint8 a)
 
quint16 scaleToA (quint8 a)
 This specialization is needed because the default implementation won't work when scaling up.
 
quint8 scaleToA (quint8 a)
 

Static Public Member Functions

static dst_compositetype and (_T a, _Tdst b)
 
static _T blend (_T a, _T b, _T alpha)
 
static dst_compositetype clamp (dst_compositetype val)
 
static _Tdst clampAfterScale (dst_compositetype val)
 
static _T clampChannelToSDR (_T val)
 
static _T clampChannelToSDRBottom (_T val)
 
static dst_compositetype clampToSDR (dst_compositetype val)
 
static dst_compositetype clampToSDRBottom (dst_compositetype val)
 
static dst_compositetype clampToSDRTop (dst_compositetype val)
 
static dst_compositetype divide (_T a, _Tdst b)
 
static dst_compositetype divideInCompositeSpace (dst_compositetype a, dst_compositetype b)
 
static _T invert (_T a)
 
static bool isHalfValueFuzzy (_T v)
 
static bool isUnitValueClampedFuzzy (_T v)
 
static bool isUnitValueFuzzy (_T value)
 
static _T isUnsafeAsDivisor (_T value)
 
static bool isZeroValueClampedFuzzy (_T v)
 
static bool isZeroValueFuzzy (_T value)
 
static dst_compositetype modulus (_T a, _Tdst b)
 
static _Tdst multiply (_T a, _Tdst b)
 
static _Tdst multiply (_T a, _Tdst b, _Tdst c)
 
static dst_compositetype multiplyInCompositeSpace (dst_compositetype a, dst_compositetype b)
 
static dst_compositetype or (_T a, _Tdst b)
 
static _Tdst scaleToA (_T a)
 
static dst_compositetype xor (_T a, _Tdst b)
 

Private Types

typedef KoColorSpaceMathsTraits< _Tdst >::compositetype dst_compositetype
 
typedef traits::compositetype src_compositetype
 
typedef KoColorSpaceMathsTraits< _T > traits
 

Detailed Description

template<typename _T, typename _Tdst = _T>
class KoColorSpaceMaths< _T, _Tdst >

This class defines some elementary operations used by various color space. It's intended to be generic, but some specialization exists either for optimization or just for being buildable.

Parameters
_Tsome numerical type with an existing trait
_Tdstsome other numerical type with an existing trait, it is only needed if different of _T

Definition at line 208 of file KoColorSpaceMaths.h.

Member Typedef Documentation

◆ dst_compositetype

template<typename _T , typename _Tdst = _T>
typedef KoColorSpaceMathsTraits<_Tdst>::compositetype KoColorSpaceMaths< _T, _Tdst >::dst_compositetype
private

Definition at line 212 of file KoColorSpaceMaths.h.

◆ src_compositetype

template<typename _T , typename _Tdst = _T>
typedef traits::compositetype KoColorSpaceMaths< _T, _Tdst >::src_compositetype
private

Definition at line 211 of file KoColorSpaceMaths.h.

◆ traits

template<typename _T , typename _Tdst = _T>
typedef KoColorSpaceMathsTraits<_T> KoColorSpaceMaths< _T, _Tdst >::traits
private

Definition at line 210 of file KoColorSpaceMaths.h.

Member Function Documentation

◆ and()

template<typename _T , typename _Tdst = _T>
static dst_compositetype KoColorSpaceMaths< _T, _Tdst >::and ( _T a,
_Tdst b )
inlinestatic

Definition at line 240 of file KoColorSpaceMaths.h.

240 {
241 return (int (a * std::numeric_limits<int>::max() - traits::epsilon) & int (b * std::numeric_limits<int>::max() - traits::epsilon));
242 }

◆ blend() [1/3]

template<typename _T , typename _Tdst = _T>
static _T KoColorSpaceMaths< _T, _Tdst >::blend ( _T a,
_T b,
_T alpha )
inlinestatic

Blending : (a * alpha) + b * (1 - alpha)

Parameters
a
b
alpha

Definition at line 262 of file KoColorSpaceMaths.h.

262 {
263 src_compositetype c = ((src_compositetype(a) - b) * alpha) / traits::unitValue;
264 return c + b;
265 }
traits::compositetype src_compositetype

◆ blend() [2/3]

float KoColorSpaceMaths< float >::blend ( float a,
float b,
float alpha )
inline

Definition at line 471 of file KoColorSpaceMaths.h.

472{
473 return (a - b) * alpha + b;
474}

◆ blend() [3/3]

quint8 KoColorSpaceMaths< quint8 >::blend ( quint8 a,
quint8 b,
quint8 c )
inline

Definition at line 655 of file KoColorSpaceMaths.h.

656{
657 return UINT8_BLEND(a, b, c);
658}
uint UINT8_BLEND(uint a, uint b, uint alpha)

References UINT8_BLEND().

◆ clamp() [1/3]

double KoColorSpaceMaths< double >::clamp ( double a)
inline

Definition at line 391 of file KoColorSpaceMaths.h.

392{
393 return a;
394}

◆ clamp() [2/3]

template<typename _T , typename _Tdst = _T>
static dst_compositetype KoColorSpaceMaths< _T, _Tdst >::clamp ( dst_compositetype val)
inlinestatic

Definition at line 274 of file KoColorSpaceMaths.h.

274 {
275 return kisBoundFast<dst_compositetype>(KoColorSpaceMathsTraits<_Tdst>::min, val, KoColorSpaceMathsTraits<_Tdst>::max);
276 }

◆ clamp() [3/3]

float KoColorSpaceMaths< float >::clamp ( float a)
inline

Definition at line 477 of file KoColorSpaceMaths.h.

478{
479 return a;
480}

◆ clampAfterScale()

template<typename _T , typename _Tdst = _T>
static _Tdst KoColorSpaceMaths< _T, _Tdst >::clampAfterScale ( dst_compositetype val)
inlinestatic

Clamps the composite type on higher border only. That is a fast path for scale-only transformations

Definition at line 327 of file KoColorSpaceMaths.h.

327 {
328 return qMin<dst_compositetype>(val, KoColorSpaceMathsTraits<_Tdst>::max);
329 }

◆ clampChannelToSDR()

template<typename _T , typename _Tdst = _T>
static _T KoColorSpaceMaths< _T, _Tdst >::clampChannelToSDR ( _T val)
inlinestatic

Definition at line 278 of file KoColorSpaceMaths.h.

278 {
279 if constexpr (std::numeric_limits<_T>::is_integer) {
280 return val;
281 } else {
283 }
284 }

◆ clampChannelToSDRBottom()

template<typename _T , typename _Tdst = _T>
static _T KoColorSpaceMaths< _T, _Tdst >::clampChannelToSDRBottom ( _T val)
inlinestatic

Definition at line 286 of file KoColorSpaceMaths.h.

287 {
288 if constexpr (std::numeric_limits<_T>::is_integer) {
289 return val;
290 } else {
291 return qMax<_T>(KoColorSpaceMathsTraits<_T>::zeroValue, val);
292 }
293 }

◆ clampToSDR()

template<typename _T , typename _Tdst = _T>
static dst_compositetype KoColorSpaceMaths< _T, _Tdst >::clampToSDR ( dst_compositetype val)
inlinestatic

Definition at line 295 of file KoColorSpaceMaths.h.

295 {
297 }

◆ clampToSDRBottom()

template<typename _T , typename _Tdst = _T>
static dst_compositetype KoColorSpaceMaths< _T, _Tdst >::clampToSDRBottom ( dst_compositetype val)
inlinestatic

Definition at line 303 of file KoColorSpaceMaths.h.

303 {
304 return qMax<dst_compositetype>(KoColorSpaceMathsTraits<_Tdst>::zeroValue, val);
305 }

◆ clampToSDRTop()

template<typename _T , typename _Tdst = _T>
static dst_compositetype KoColorSpaceMaths< _T, _Tdst >::clampToSDRTop ( dst_compositetype val)
inlinestatic

Definition at line 299 of file KoColorSpaceMaths.h.

299 {
300 return qMin<dst_compositetype>(val, KoColorSpaceMathsTraits<_Tdst>::unitValue);
301 }

◆ divide() [1/3]

template<typename _T , typename _Tdst = _T>
static dst_compositetype KoColorSpaceMaths< _T, _Tdst >::divide ( _T a,
_Tdst b )
inlinestatic

Division : (a * MAX ) / b

Parameters
a
b

Definition at line 228 of file KoColorSpaceMaths.h.

228 {
230 }
KoColorSpaceMathsTraits< _Tdst >::compositetype dst_compositetype

◆ divide() [2/3]

KoColorSpaceMathsTraits< quint16 >::compositetype KoColorSpaceMaths< quint16 >::divide ( quint16 a,
quint16 b )
inline

Definition at line 670 of file KoColorSpaceMaths.h.

671{
672 return UINT16_DIVIDE(a, b);
673}
uint UINT16_DIVIDE(uint a, uint b)

References UINT16_DIVIDE().

◆ divide() [3/3]

KoColorSpaceMathsTraits< quint8 >::compositetype KoColorSpaceMaths< quint8 >::divide ( quint8 a,
quint8 b )
inline

Definition at line 643 of file KoColorSpaceMaths.h.

644{
645 return UINT8_DIVIDE(a, b);
646}
uint UINT8_DIVIDE(uint a, uint b)

References UINT8_DIVIDE().

◆ divideInCompositeSpace()

template<typename _T , typename _Tdst = _T>
static dst_compositetype KoColorSpaceMaths< _T, _Tdst >::divideInCompositeSpace ( dst_compositetype a,
dst_compositetype b )
inlinestatic

Definition at line 307 of file KoColorSpaceMaths.h.

307 {
308 if constexpr (std::numeric_limits<_Tdst>::is_integer) {
310 } else {
311 return a / b;
312 }
313 }

◆ invert() [1/3]

template<typename _T , typename _Tdst = _T>
static _T KoColorSpaceMaths< _T, _Tdst >::invert ( _T a)
inlinestatic

Inversion : unitValue - a

Parameters
a

Definition at line 252 of file KoColorSpaceMaths.h.

252 {
253 return traits::unitValue - a;
254 }

◆ invert() [2/3]

quint16 KoColorSpaceMaths< quint16 >::invert ( quint16 a)
inline

Definition at line 676 of file KoColorSpaceMaths.h.

677{
678 return ~a;
679}

◆ invert() [3/3]

quint8 KoColorSpaceMaths< quint8 >::invert ( quint8 a)
inline

Definition at line 649 of file KoColorSpaceMaths.h.

650{
651 return ~a;
652}

◆ isHalfValueFuzzy() [1/3]

template<typename _T , typename _Tdst = _T>
static bool KoColorSpaceMaths< _T, _Tdst >::isHalfValueFuzzy ( _T v)
inlinestatic

Definition at line 356 of file KoColorSpaceMaths.h.

357 {
358 static_assert(std::numeric_limits<_Tdst>::is_integer);
360 }
qreal v

References v.

◆ isHalfValueFuzzy() [2/3]

bool KoColorSpaceMaths< double >::isHalfValueFuzzy ( double value)
inline

Definition at line 426 of file KoColorSpaceMaths.h.

426 {
428}
float value(const T *src, size_t ch)
static bool qFuzzyCompare(half p1, half p2)

References qFuzzyCompare(), and value().

◆ isHalfValueFuzzy() [3/3]

bool KoColorSpaceMaths< float >::isHalfValueFuzzy ( float value)
inline

Definition at line 512 of file KoColorSpaceMaths.h.

References qFuzzyCompare(), and value().

◆ isUnitValueClampedFuzzy() [1/3]

template<typename _T , typename _Tdst = _T>
static bool KoColorSpaceMaths< _T, _Tdst >::isUnitValueClampedFuzzy ( _T v)
inlinestatic

Definition at line 351 of file KoColorSpaceMaths.h.

351 {
352 static_assert(std::numeric_limits<_Tdst>::is_integer);
354 }

References v.

◆ isUnitValueClampedFuzzy() [2/3]

bool KoColorSpaceMaths< double >::isUnitValueClampedFuzzy ( double d)
inline

Definition at line 419 of file KoColorSpaceMaths.h.

420{
421 // constant is from qFuzzyIsNull()
422 return d > 1.0 - 0.000000000001;
423}

◆ isUnitValueClampedFuzzy() [3/3]

bool KoColorSpaceMaths< float >::isUnitValueClampedFuzzy ( float f)
inline

Definition at line 505 of file KoColorSpaceMaths.h.

506{
507 // constant is from qFuzzyIsNull()
508 return f > 1.0 - 0.00001f;
509}

◆ isUnitValueFuzzy() [1/3]

template<typename _T , typename _Tdst = _T>
static bool KoColorSpaceMaths< _T, _Tdst >::isUnitValueFuzzy ( _T value)
inlinestatic

Definition at line 336 of file KoColorSpaceMaths.h.

336 {
337 static_assert(std::numeric_limits<_Tdst>::is_integer);
339 }

References value().

◆ isUnitValueFuzzy() [2/3]

bool KoColorSpaceMaths< double >::isUnitValueFuzzy ( double value)
inline

Definition at line 402 of file KoColorSpaceMaths.h.

References qFuzzyCompare(), and value().

◆ isUnitValueFuzzy() [3/3]

bool KoColorSpaceMaths< float >::isUnitValueFuzzy ( float value)
inline

Definition at line 488 of file KoColorSpaceMaths.h.

References qFuzzyCompare(), and value().

◆ isUnsafeAsDivisor() [1/3]

template<typename _T , typename _Tdst = _T>
static _T KoColorSpaceMaths< _T, _Tdst >::isUnsafeAsDivisor ( _T value)
inlinestatic

Definition at line 331 of file KoColorSpaceMaths.h.

331 {
332 static_assert(std::numeric_limits<_Tdst>::is_integer);
334 }

References value().

◆ isUnsafeAsDivisor() [2/3]

double KoColorSpaceMaths< double >::isUnsafeAsDivisor ( double value)
inline

Definition at line 397 of file KoColorSpaceMaths.h.

397 {
398 return value < 1e-6; // negative values are also unsafe!
399}

References value().

◆ isUnsafeAsDivisor() [3/3]

float KoColorSpaceMaths< float >::isUnsafeAsDivisor ( float value)
inline

Definition at line 483 of file KoColorSpaceMaths.h.

483 {
484 return value < 1e-6; // negative values are also unsafe!
485}

References value().

◆ isZeroValueClampedFuzzy() [1/3]

template<typename _T , typename _Tdst = _T>
static bool KoColorSpaceMaths< _T, _Tdst >::isZeroValueClampedFuzzy ( _T v)
inlinestatic

Definition at line 346 of file KoColorSpaceMaths.h.

346 {
347 static_assert(std::numeric_limits<_Tdst>::is_integer);
348 return v <= 0;
349 }

References v.

◆ isZeroValueClampedFuzzy() [2/3]

bool KoColorSpaceMaths< double >::isZeroValueClampedFuzzy ( double d)
inline

Definition at line 412 of file KoColorSpaceMaths.h.

413{
414 // constant is from qFuzzyIsNull()
415 return d <= 0.000000000001;
416}

◆ isZeroValueClampedFuzzy() [3/3]

bool KoColorSpaceMaths< float >::isZeroValueClampedFuzzy ( float f)
inline

Definition at line 498 of file KoColorSpaceMaths.h.

499{
500 // constant is from qFuzzyIsNull()
501 return f <= 0.00001f;
502}

◆ isZeroValueFuzzy() [1/3]

template<typename _T , typename _Tdst = _T>
static bool KoColorSpaceMaths< _T, _Tdst >::isZeroValueFuzzy ( _T value)
inlinestatic

Definition at line 341 of file KoColorSpaceMaths.h.

341 {
342 static_assert(std::numeric_limits<_Tdst>::is_integer);
344 }

References value().

◆ isZeroValueFuzzy() [2/3]

bool KoColorSpaceMaths< double >::isZeroValueFuzzy ( double value)
inline

Definition at line 407 of file KoColorSpaceMaths.h.

407 {
408 return qFuzzyIsNull(value);
409}
static bool qFuzzyIsNull(half h)

References qFuzzyIsNull(), and value().

◆ isZeroValueFuzzy() [3/3]

bool KoColorSpaceMaths< float >::isZeroValueFuzzy ( float value)
inline

Definition at line 493 of file KoColorSpaceMaths.h.

493 {
494 return qFuzzyIsNull(value);
495}

References qFuzzyIsNull(), and value().

◆ modulus()

template<typename _T , typename _Tdst = _T>
static dst_compositetype KoColorSpaceMaths< _T, _Tdst >::modulus ( _T a,
_Tdst b )
inlinestatic

Definition at line 232 of file KoColorSpaceMaths.h.

232 {
234 }
KoColorSpaceMathsTraits< _T > traits

◆ multiply() [1/5]

template<typename _T , typename _Tdst = _T>
static _Tdst KoColorSpaceMaths< _T, _Tdst >::multiply ( _T a,
_Tdst b )
inlinestatic

Definition at line 215 of file KoColorSpaceMaths.h.

◆ multiply() [2/5]

template<typename _T , typename _Tdst = _T>
static _Tdst KoColorSpaceMaths< _T, _Tdst >::multiply ( _T a,
_Tdst b,
_Tdst c )
inlinestatic

◆ multiply() [3/5]

quint16 KoColorSpaceMaths< quint16 >::multiply ( quint16 a,
quint16 b )
inline

Definition at line 663 of file KoColorSpaceMaths.h.

664{
665 return (quint16)UINT16_MULT(a, b);
666}
uint UINT16_MULT(uint a, uint b)

References UINT16_MULT().

◆ multiply() [4/5]

quint8 KoColorSpaceMaths< quint8 >::multiply ( quint8 a,
quint8 b )
inline

Definition at line 629 of file KoColorSpaceMaths.h.

630{
631 return (quint8)UINT8_MULT(a, b);
632}
uint UINT8_MULT(uint a, uint b)

References UINT8_MULT().

◆ multiply() [5/5]

quint8 KoColorSpaceMaths< quint8 >::multiply ( quint8 a,
quint8 b,
quint8 c )
inline

Definition at line 636 of file KoColorSpaceMaths.h.

637{
638 return (quint8)UINT8_MULT3(a, b, c);
639}
uint UINT8_MULT3(uint a, uint b, uint c)
Approximation of (a * b * c + 32512) / 65025.0.

References UINT8_MULT3().

◆ multiplyInCompositeSpace()

template<typename _T , typename _Tdst = _T>
static dst_compositetype KoColorSpaceMaths< _T, _Tdst >::multiplyInCompositeSpace ( dst_compositetype a,
dst_compositetype b )
inlinestatic

Definition at line 315 of file KoColorSpaceMaths.h.

315 {
316 if constexpr (std::numeric_limits<_Tdst>::is_integer) {
318 } else {
319 return a * b;
320 }
321 }

◆ or()

template<typename _T , typename _Tdst = _T>
static dst_compositetype KoColorSpaceMaths< _T, _Tdst >::or ( _T a,
_Tdst b )
inlinestatic

Definition at line 244 of file KoColorSpaceMaths.h.

244 {
245 return (int (a * std::numeric_limits<int>::max() - traits::epsilon) | int (b * std::numeric_limits<int>::max() - traits::epsilon));
246 }

◆ scaleToA() [1/16]

template<typename _T , typename _Tdst = _T>
static _Tdst KoColorSpaceMaths< _T, _Tdst >::scaleToA ( _T a)
inlinestatic

This function will scale a value of type _T to fit into a _Tdst.

Definition at line 270 of file KoColorSpaceMaths.h.

◆ scaleToA() [2/16]

quint8 KoColorSpaceMaths< double, quint8 >::scaleToA ( double a)
inline

Definition at line 365 of file KoColorSpaceMaths.h.

366{
367 double v = a * 255;
368 return float2int(CLAMP(v, 0, 255));
369}
int float2int(float x)
#define CLAMP(x, l, h)

References CLAMP, float2int(), and v.

◆ scaleToA() [3/16]

quint16 KoColorSpaceMaths< double, quint16 >::scaleToA ( double a)
inline

Definition at line 378 of file KoColorSpaceMaths.h.

379{
380 double v = a * 0xFFFF;
381 return float2int(CLAMP(v, 0, 0xFFFF));
382}

References CLAMP, float2int(), and v.

◆ scaleToA() [4/16]

float KoColorSpaceMaths< double, float >::scaleToA ( double a)
inline

Definition at line 433 of file KoColorSpaceMaths.h.

434{
435 return (float)a;
436}

◆ scaleToA() [5/16]

double KoColorSpaceMaths< float, double >::scaleToA ( float a)
inline

Definition at line 439 of file KoColorSpaceMaths.h.

440{
441 return a;
442}

◆ scaleToA() [6/16]

quint16 KoColorSpaceMaths< float, quint16 >::scaleToA ( float a)
inline

Definition at line 445 of file KoColorSpaceMaths.h.

446{
447 float v = a * 0xFFFF;
448 return (quint16)float2int(CLAMP(v, 0, 0xFFFF));
449}

References CLAMP, float2int(), and v.

◆ scaleToA() [7/16]

quint8 KoColorSpaceMaths< float, quint8 >::scaleToA ( float a)
inline

Definition at line 458 of file KoColorSpaceMaths.h.

459{
460 float v = a * 255;
461 return (quint8)float2int(CLAMP(v, 0, 255));
462}

References CLAMP, float2int(), and v.

◆ scaleToA() [8/16]

float KoColorSpaceMaths< float, float >::scaleToA ( float a)
inline

Definition at line 715 of file KoColorSpaceMaths.h.

716{
717 return a;
718}

◆ scaleToA() [9/16]

double KoColorSpaceMaths< quint16, double >::scaleToA ( quint16 a)
inline

Definition at line 385 of file KoColorSpaceMaths.h.

386{
387 return KoLuts::Uint16ToFloat(a);
388}
static KRITAPIGMENT_EXPORT const Ko::FullLut< KoIntegerToFloat< quint16 >, float, quint16 > Uint16ToFloat

References KoLuts::Uint16ToFloat.

◆ scaleToA() [10/16]

float KoColorSpaceMaths< quint16, float >::scaleToA ( quint16 a)
inline

Definition at line 452 of file KoColorSpaceMaths.h.

453{
454 return KoLuts::Uint16ToFloat(a);
455}

References KoLuts::Uint16ToFloat.

◆ scaleToA() [11/16]

quint8 KoColorSpaceMaths< quint16, quint8 >::scaleToA ( quint16 a)
inline

Definition at line 694 of file KoColorSpaceMaths.h.

695{
696 return UINT16_TO_UINT8(a);
697}
uint UINT16_TO_UINT8(uint c)

References UINT16_TO_UINT8().

◆ scaleToA() [12/16]

quint16 KoColorSpaceMaths< quint16, quint16 >::scaleToA ( quint16 a)
inline

Definition at line 709 of file KoColorSpaceMaths.h.

710{
711 return a;
712}

◆ scaleToA() [13/16]

double KoColorSpaceMaths< quint8, double >::scaleToA ( quint8 a)
inline

Definition at line 372 of file KoColorSpaceMaths.h.

373{
374 return KoLuts::Uint8ToFloat(a);
375}
static KRITAPIGMENT_EXPORT const Ko::FullLut< KoIntegerToFloat< quint8 >, float, quint8 > Uint8ToFloat

References KoLuts::Uint8ToFloat.

◆ scaleToA() [14/16]

float KoColorSpaceMaths< quint8, float >::scaleToA ( quint8 a)
inline

Definition at line 465 of file KoColorSpaceMaths.h.

466{
467 return KoLuts::Uint8ToFloat(a);
468}

References KoLuts::Uint8ToFloat.

◆ scaleToA() [15/16]

quint16 KoColorSpaceMaths< quint8, quint16 >::scaleToA ( quint8 a)
inline

This specialization is needed because the default implementation won't work when scaling up.

Definition at line 688 of file KoColorSpaceMaths.h.

689{
690 return UINT8_TO_UINT16(a);
691}
uint UINT8_TO_UINT16(uint c)

References UINT8_TO_UINT16().

◆ scaleToA() [16/16]

quint8 KoColorSpaceMaths< quint8, quint8 >::scaleToA ( quint8 a)
inline

Definition at line 703 of file KoColorSpaceMaths.h.

704{
705 return a;
706}

◆ xor()

template<typename _T , typename _Tdst = _T>
static dst_compositetype KoColorSpaceMaths< _T, _Tdst >::xor ( _T a,
_Tdst b )
inlinestatic

Definition at line 236 of file KoColorSpaceMaths.h.

236 {
237 return (int (a * std::numeric_limits<int>::max() - traits::epsilon) ^ int (b * std::numeric_limits<int>::max() - traits::epsilon));
238 }

The documentation for this class was generated from the following files: