Krita Source Code Documentation
Loading...
Searching...
No Matches
KisMaskingBrushCompositeOp< channels_type, composite_function, mask_is_alpha, use_strength, use_soft_texturing > Class Template Reference

#include <KisMaskingBrushCompositeOp.h>

+ Inheritance diagram for KisMaskingBrushCompositeOp< channels_type, composite_function, mask_is_alpha, use_strength, use_soft_texturing >:

Public Types

using MaskPixel = typename std::conditional<mask_is_alpha, quint8, KoGrayU8Traits::Pixel>::type
 

Public Member Functions

void composite (const quint8 *srcRowStart, int srcRowStride, quint8 *dstRowStart, int dstRowStride, int columns, int rows) override
 
template<bool use_strength_ = use_strength, typename = typename std::enable_if<!use_strength_>::type>
 KisMaskingBrushCompositeOp (int dstPixelSize, int dstAlphaOffset)
 
template<bool use_strength_ = use_strength, typename = typename std::enable_if<use_strength_>::type>
 KisMaskingBrushCompositeOp (int dstPixelSize, int dstAlphaOffset, qreal strength)
 
- Public Member Functions inherited from KisMaskingBrushCompositeOpBase
virtual ~KisMaskingBrushCompositeOpBase ()=default
 

Private Member Functions

quint8 preprocessMask (const KoGrayU8Traits::Pixel *pixel)
 
quint8 preprocessMask (const quint8 *pixel)
 

Private Attributes

KisMaskingBrushCompositeDetail::CompositeFunction< channels_type, composite_function, use_strength, use_soft_texturing > m_compositeFunction
 
int m_dstAlphaOffset
 
int m_dstPixelSize
 

Detailed Description

template<typename channels_type, int composite_function, bool mask_is_alpha = false, bool use_strength = false, bool use_soft_texturing = false>
class KisMaskingBrushCompositeOp< channels_type, composite_function, mask_is_alpha, use_strength, use_soft_texturing >

Definition at line 715 of file KisMaskingBrushCompositeOp.h.

Member Typedef Documentation

◆ MaskPixel

template<typename channels_type , int composite_function, bool mask_is_alpha = false, bool use_strength = false, bool use_soft_texturing = false>
using KisMaskingBrushCompositeOp< channels_type, composite_function, mask_is_alpha, use_strength, use_soft_texturing >::MaskPixel = typename std::conditional<mask_is_alpha, quint8, KoGrayU8Traits::Pixel>::type

Definition at line 718 of file KisMaskingBrushCompositeOp.h.

Constructor & Destructor Documentation

◆ KisMaskingBrushCompositeOp() [1/2]

template<typename channels_type , int composite_function, bool mask_is_alpha = false, bool use_strength = false, bool use_soft_texturing = false>
template<bool use_strength_ = use_strength, typename = typename std::enable_if<!use_strength_>::type>
KisMaskingBrushCompositeOp< channels_type, composite_function, mask_is_alpha, use_strength, use_soft_texturing >::KisMaskingBrushCompositeOp ( int dstPixelSize,
int dstAlphaOffset )
inline

Definition at line 721 of file KisMaskingBrushCompositeOp.h.

◆ KisMaskingBrushCompositeOp() [2/2]

template<typename channels_type , int composite_function, bool mask_is_alpha = false, bool use_strength = false, bool use_soft_texturing = false>
template<bool use_strength_ = use_strength, typename = typename std::enable_if<use_strength_>::type>
KisMaskingBrushCompositeOp< channels_type, composite_function, mask_is_alpha, use_strength, use_soft_texturing >::KisMaskingBrushCompositeOp ( int dstPixelSize,
int dstAlphaOffset,
qreal strength )
inline

Definition at line 727 of file KisMaskingBrushCompositeOp.h.

728 : m_dstPixelSize(dstPixelSize)
729 , m_dstAlphaOffset(dstAlphaOffset)
730 , m_compositeFunction(strength)
731 {}
KisMaskingBrushCompositeDetail::CompositeFunction< channels_type, composite_function, use_strength, use_soft_texturing > m_compositeFunction

Member Function Documentation

◆ composite()

template<typename channels_type , int composite_function, bool mask_is_alpha = false, bool use_strength = false, bool use_soft_texturing = false>
void KisMaskingBrushCompositeOp< channels_type, composite_function, mask_is_alpha, use_strength, use_soft_texturing >::composite ( const quint8 * srcRowStart,
int srcRowStride,
quint8 * dstRowStart,
int dstRowStride,
int columns,
int rows )
inlineoverridevirtual

Implements KisMaskingBrushCompositeOpBase.

Definition at line 733 of file KisMaskingBrushCompositeOp.h.

736 {
737 dstRowStart += m_dstAlphaOffset;
738
739 for (int y = 0; y < rows; y++) {
740 const quint8 *srcPtr = srcRowStart;
741 quint8 *dstPtr = dstRowStart;
742
743 for (int x = 0; x < columns; x++) {
744
745 const MaskPixel *srcDataPtr = reinterpret_cast<const MaskPixel*>(srcPtr);
746
747 const quint8 mask = preprocessMask(srcDataPtr);
748 const channels_type maskScaled = KoColorSpaceMaths<quint8, channels_type>::scaleToA(mask);
749
750 channels_type *dstDataPtr = reinterpret_cast<channels_type*>(dstPtr);
751 *dstDataPtr = m_compositeFunction.apply(maskScaled, *dstDataPtr);
752
753 srcPtr += sizeof(MaskPixel);
754 dstPtr += m_dstPixelSize;
755 }
756
757 srcRowStart += srcRowStride;
758 dstRowStart += dstRowStride;
759 }
760 }
quint8 preprocessMask(const quint8 *pixel)
typename std::conditional< mask_is_alpha, quint8, KoGrayU8Traits::Pixel >::type MaskPixel
static _Tdst scaleToA(_T a)

References KisMaskingBrushCompositeOp< channels_type, composite_function, mask_is_alpha, use_strength, use_soft_texturing >::m_compositeFunction, KisMaskingBrushCompositeOp< channels_type, composite_function, mask_is_alpha, use_strength, use_soft_texturing >::m_dstAlphaOffset, KisMaskingBrushCompositeOp< channels_type, composite_function, mask_is_alpha, use_strength, use_soft_texturing >::m_dstPixelSize, KisMaskingBrushCompositeOp< channels_type, composite_function, mask_is_alpha, use_strength, use_soft_texturing >::preprocessMask(), and KoColorSpaceMaths< _T, _Tdst >::scaleToA().

◆ preprocessMask() [1/2]

template<typename channels_type , int composite_function, bool mask_is_alpha = false, bool use_strength = false, bool use_soft_texturing = false>
quint8 KisMaskingBrushCompositeOp< channels_type, composite_function, mask_is_alpha, use_strength, use_soft_texturing >::preprocessMask ( const KoGrayU8Traits::Pixel * pixel)
inlineprivate

Definition at line 769 of file KisMaskingBrushCompositeOp.h.

770 {
771 return KoColorSpaceMaths<quint8>::multiply(pixel->gray, pixel->alpha);
772 }
static _Tdst multiply(_T a, _Tdst b)

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

◆ preprocessMask() [2/2]

template<typename channels_type , int composite_function, bool mask_is_alpha = false, bool use_strength = false, bool use_soft_texturing = false>
quint8 KisMaskingBrushCompositeOp< channels_type, composite_function, mask_is_alpha, use_strength, use_soft_texturing >::preprocessMask ( const quint8 * pixel)
inlineprivate

Definition at line 764 of file KisMaskingBrushCompositeOp.h.

765 {
766 return *pixel;
767 }

Member Data Documentation

◆ m_compositeFunction

template<typename channels_type , int composite_function, bool mask_is_alpha = false, bool use_strength = false, bool use_soft_texturing = false>
KisMaskingBrushCompositeDetail::CompositeFunction<channels_type, composite_function, use_strength, use_soft_texturing> KisMaskingBrushCompositeOp< channels_type, composite_function, mask_is_alpha, use_strength, use_soft_texturing >::m_compositeFunction
private

Definition at line 778 of file KisMaskingBrushCompositeOp.h.

◆ m_dstAlphaOffset

template<typename channels_type , int composite_function, bool mask_is_alpha = false, bool use_strength = false, bool use_soft_texturing = false>
int KisMaskingBrushCompositeOp< channels_type, composite_function, mask_is_alpha, use_strength, use_soft_texturing >::m_dstAlphaOffset
private

Definition at line 776 of file KisMaskingBrushCompositeOp.h.

◆ m_dstPixelSize

template<typename channels_type , int composite_function, bool mask_is_alpha = false, bool use_strength = false, bool use_soft_texturing = false>
int KisMaskingBrushCompositeOp< channels_type, composite_function, mask_is_alpha, use_strength, use_soft_texturing >::m_dstPixelSize
private

Definition at line 775 of file KisMaskingBrushCompositeOp.h.


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