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

Classes

struct  CompositeFunction
 
struct  CompositeFunction< channels_type, KIS_MASKING_BRUSH_COMPOSITE_BURN, false, false >
 
struct  CompositeFunction< channels_type, KIS_MASKING_BRUSH_COMPOSITE_BURN, true, false >
 
struct  CompositeFunction< channels_type, KIS_MASKING_BRUSH_COMPOSITE_BURN, true, true >
 
struct  CompositeFunction< channels_type, KIS_MASKING_BRUSH_COMPOSITE_DARKEN, false, false >
 
struct  CompositeFunction< channels_type, KIS_MASKING_BRUSH_COMPOSITE_DARKEN, true, false >
 
struct  CompositeFunction< channels_type, KIS_MASKING_BRUSH_COMPOSITE_DARKEN, true, true >
 
struct  CompositeFunction< channels_type, KIS_MASKING_BRUSH_COMPOSITE_DODGE, false, false >
 
struct  CompositeFunction< channels_type, KIS_MASKING_BRUSH_COMPOSITE_DODGE, true, use_soft_texturing >
 
struct  CompositeFunction< channels_type, KIS_MASKING_BRUSH_COMPOSITE_HARD_MIX_PHOTOSHOP, false, false >
 
struct  CompositeFunction< channels_type, KIS_MASKING_BRUSH_COMPOSITE_HARD_MIX_PHOTOSHOP, true, false >
 
struct  CompositeFunction< channels_type, KIS_MASKING_BRUSH_COMPOSITE_HARD_MIX_PHOTOSHOP, true, true >
 
struct  CompositeFunction< channels_type, KIS_MASKING_BRUSH_COMPOSITE_HARD_MIX_SOFTER_PHOTOSHOP, false, false >
 
struct  CompositeFunction< channels_type, KIS_MASKING_BRUSH_COMPOSITE_HARD_MIX_SOFTER_PHOTOSHOP, true, use_soft_texturing >
 
struct  CompositeFunction< channels_type, KIS_MASKING_BRUSH_COMPOSITE_HEIGHT, true, use_soft_texturing >
 
struct  CompositeFunction< channels_type, KIS_MASKING_BRUSH_COMPOSITE_HEIGHT_PHOTOSHOP, true, false >
 
struct  CompositeFunction< channels_type, KIS_MASKING_BRUSH_COMPOSITE_HEIGHT_PHOTOSHOP, true, true >
 
struct  CompositeFunction< channels_type, KIS_MASKING_BRUSH_COMPOSITE_LINEAR_BURN, false, false >
 
struct  CompositeFunction< channels_type, KIS_MASKING_BRUSH_COMPOSITE_LINEAR_BURN, true, false >
 
struct  CompositeFunction< channels_type, KIS_MASKING_BRUSH_COMPOSITE_LINEAR_BURN, true, true >
 
struct  CompositeFunction< channels_type, KIS_MASKING_BRUSH_COMPOSITE_LINEAR_DODGE, false, false >
 
struct  CompositeFunction< channels_type, KIS_MASKING_BRUSH_COMPOSITE_LINEAR_DODGE, true, use_soft_texturing >
 
struct  CompositeFunction< channels_type, KIS_MASKING_BRUSH_COMPOSITE_LINEAR_HEIGHT, true, use_soft_texturing >
 
struct  CompositeFunction< channels_type, KIS_MASKING_BRUSH_COMPOSITE_LINEAR_HEIGHT_PHOTOSHOP, true, false >
 
struct  CompositeFunction< channels_type, KIS_MASKING_BRUSH_COMPOSITE_LINEAR_HEIGHT_PHOTOSHOP, true, true >
 
struct  CompositeFunction< channels_type, KIS_MASKING_BRUSH_COMPOSITE_MULT, false, false >
 
struct  CompositeFunction< channels_type, KIS_MASKING_BRUSH_COMPOSITE_MULT, true, false >
 
struct  CompositeFunction< channels_type, KIS_MASKING_BRUSH_COMPOSITE_MULT, true, true >
 
struct  CompositeFunction< channels_type, KIS_MASKING_BRUSH_COMPOSITE_OVERLAY, false, false >
 
struct  CompositeFunction< channels_type, KIS_MASKING_BRUSH_COMPOSITE_OVERLAY, true, false >
 
struct  CompositeFunction< channels_type, KIS_MASKING_BRUSH_COMPOSITE_OVERLAY, true, true >
 
struct  CompositeFunction< channels_type, KIS_MASKING_BRUSH_COMPOSITE_SUBTRACT, false, false >
 
struct  CompositeFunction< channels_type, KIS_MASKING_BRUSH_COMPOSITE_SUBTRACT, true, false >
 
struct  CompositeFunction< channels_type, KIS_MASKING_BRUSH_COMPOSITE_SUBTRACT, true, true >
 
struct  StrengthCompositeFunctionBase
 

Functions

template<class T >
colorBurnAlpha (T src, T dst)
 
template<class T >
colorBurnAlphaHelper (T src, T dst)
 
template<class T >
std::enable_if< std::numeric_limits< T >::is_integer, T >::type colorDodgeAlpha (T src, T dst)
 
template<class T >
std::enable_if<!std::numeric_limits< T >::is_integer, T >::type colorDodgeAlpha (T src, T dst)
 
template<class T >
colorDodgeAlphaHelper (T src, T dst)
 
template<class T >
hardMixSofterPhotoshopAlpha (T src, T dst)
 

Function Documentation

◆ colorBurnAlpha()

template<class T >
T KisMaskingBrushCompositeDetail::colorBurnAlpha ( T src,
T dst )
inline

Definition at line 272 of file KisMaskingBrushCompositeOp.h.

273{
274 using namespace Arithmetic;
275 using namespace KoCompositeOpClampPolicy;
276 return CFColorBurn<T>::composeChannel(src, dst);
277}
static T composeChannel(T src, T dst)

References CFColorBurn< T >::composeChannel().

◆ colorBurnAlphaHelper()

template<class T >
T KisMaskingBrushCompositeDetail::colorBurnAlphaHelper ( T src,
T dst )
inline

A special Color Burn variant for alpha channel.

The meaning of alpha channel is a bit different from the one in color. Color burn can quickly make the values less than 0 so, contrary to the color values case, we should clamp to the unit range

Definition at line 257 of file KisMaskingBrushCompositeOp.h.

258{
259 using composite_type = typename KoColorSpaceMathsTraits<T>::compositetype;
260 using namespace Arithmetic;
261 // Handle the case where the denominator is 0. See color dodge for a
262 // detailed explanation
263 if(isZeroValueFuzzy<T>(src)) {
264 return isUnitValueFuzzy<T>(dst) ? zeroValue<T>() : unitValue<T>();
265 }
267 div(inv(dst), src),
269}
constexpr const T & kisBoundFast(const T &min, const T &val, const T &max)
Definition kis_global.h:37

References kisBoundFast().

◆ colorDodgeAlpha() [1/2]

template<class T >
std::enable_if< std::numeric_limits< T >::is_integer, T >::type KisMaskingBrushCompositeDetail::colorDodgeAlpha ( T src,
T dst )
inline

Definition at line 207 of file KisMaskingBrushCompositeOp.h.

208{
209 return colorDodgeAlphaHelper(src, dst);
210}

References colorDodgeAlphaHelper().

◆ colorDodgeAlpha() [2/2]

template<class T >
std::enable_if<!std::numeric_limits< T >::is_integer, T >::type KisMaskingBrushCompositeDetail::colorDodgeAlpha ( T src,
T dst )
inline

Definition at line 215 of file KisMaskingBrushCompositeOp.h.

216{
217 const T result = colorDodgeAlphaHelper(src, dst);
218 // Constantly dividing by small numbers can quickly make the result
219 // become infinity or NaN, so we check that and correct (kind of clamping)
220 return std::isfinite(result) ? result : KoColorSpaceMathsTraits<T>::unitValue;
221}

References colorDodgeAlphaHelper().

◆ colorDodgeAlphaHelper()

template<class T >
T KisMaskingBrushCompositeDetail::colorDodgeAlphaHelper ( T src,
T dst )
inline

A special Color Dodge variant for alpha channel.

The meaning of alpha channel is a bit different from the one in color. Color dodge can quickly make the values higher than 1 or less than 0 so, contrary to the color values case, we should clamp to the unit range

Definition at line 181 of file KisMaskingBrushCompositeOp.h.

182{
183 using composite_type = typename KoColorSpaceMathsTraits<T>::compositetype;
184 using namespace Arithmetic;
185 // Handle the case where the denominator is 0.
186 // When src is 1 then the denominator (1 - src) becomes 0, and to avoid
187 // dividing by 0 we treat the denominator as an infinitely small number,
188 // so the result of the formula would approach infinity.
189 // For alpha values, the result should be clamped to the unit range,
190 // contrary to the color version, where the values should be clamped to
191 // the min/max range.
192 // Another special case is when both numerator and denominator are 0. In
193 // this case we also treat the denominator as an infinitely small number,
194 // and the numerator can remain as 0, so dividing 0 over a number (no matter
195 // how small it is) gives 0.
196 if (isUnitValueFuzzy<T>(src)) {
197 return isZeroValueFuzzy<T>(dst) ? zeroValue<T>() : unitValue<T>();
198 }
200 div(dst, inv(src)),
202}

References kisBoundFast().

◆ hardMixSofterPhotoshopAlpha()

template<class T >
T KisMaskingBrushCompositeDetail::hardMixSofterPhotoshopAlpha ( T src,
T dst )
inline

A special Hard Mix Softer variant for alpha channel

The meaning of alpha channel is a bit different from the one in color. We have to clamp the values to the unit range

Definition at line 464 of file KisMaskingBrushCompositeOp.h.

464 {
465 using namespace Arithmetic;
466 typedef typename KoColorSpaceMathsTraits<T>::compositetype composite_type;
467 const composite_type srcScaleFactor = static_cast<composite_type>(2);
468 const composite_type dstScaleFactor = static_cast<composite_type>(3);
470 dstScaleFactor * dst - srcScaleFactor * inv(src),
472}

References kisBoundFast().