Krita Source Code Documentation
Loading...
Searching...
No Matches
CFParallel< T > Struct Template Reference

#include <KoCompositeOpFunctions.h>

+ Inheritance diagram for CFParallel< T >:

Static Public Member Functions

static T composeChannel (T src, T dst)
 
- Static Public Member Functions inherited from KoClampedSourceAndDestinationCompositeOpGenericFunctorBase< T >
static T clampDestinationChannelValue (T value)
 
static T clampSourceChannelValue (T value)
 

Detailed Description

template<class T>
struct CFParallel< T >

Definition at line 614 of file KoCompositeOpFunctions.h.

Member Function Documentation

◆ composeChannel()

template<class T >
static T CFParallel< T >::composeChannel ( T src,
T dst )
inlinestatic

Definition at line 615 of file KoCompositeOpFunctions.h.

615 {
616 using namespace Arithmetic;
617 typedef typename KoColorSpaceMathsTraits<T>::compositetype composite_type;
618
619 const bool srcIsSafe = !isUnsafeAsDivisor(src);
620 const bool dstIsSafe = !isUnsafeAsDivisor(dst);
621
622 if (!srcIsSafe || !dstIsSafe) {
623 return zeroValue<T>();
624 }
625
626 // min(max(2 / (1/dst + 1/src), 0), 1)
627 composite_type unit = unitValue<T>();
628 composite_type s = div<T>(unit, src);
629 composite_type d = div<T>(unit, dst);
630
631 return clamp<T>((unit+unit) * unit / (d+s));
632 }
T isUnsafeAsDivisor(T value)

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