Krita Source Code Documentation
Loading...
Searching...
No Matches
KoLabDarkenColorTransformation< _lab_channels_type_ > Struct Template Reference

#include <KoLabDarkenColorTransformation.h>

+ Inheritance diagram for KoLabDarkenColorTransformation< _lab_channels_type_ >:

Public Member Functions

 KoLabDarkenColorTransformation (qint32 shade, bool compensate, qreal compensation, const KoColorSpace *colorspace)
 
void transform (const quint8 *src, quint8 *dst, qint32 nPixels) const override
 
- Public Member Functions inherited from KoColorTransformation
virtual bool isValid () const
 
virtual int parameterId (const QString &name) const
 
virtual QList< QString > parameters () const
 
virtual void setParameter (int id, const QVariant &parameter)
 
void setParameters (const QHash< QString, QVariant > &parameters)
 
virtual ~KoColorTransformation ()
 

Public Attributes

const KoColorSpacem_colorSpace {0}
 
bool m_compensate {false}
 
qreal m_compensation {0.0}
 
const KoColorConversionTransformationm_defaultFromLab {0}
 
const KoColorConversionTransformationm_defaultToLab {0}
 
qint32 m_shade {0}
 

Detailed Description

template<typename _lab_channels_type_>
struct KoLabDarkenColorTransformation< _lab_channels_type_ >

Definition at line 19 of file KoLabDarkenColorTransformation.h.

Constructor & Destructor Documentation

◆ KoLabDarkenColorTransformation()

template<typename _lab_channels_type_ >
KoLabDarkenColorTransformation< _lab_channels_type_ >::KoLabDarkenColorTransformation ( qint32 shade,
bool compensate,
qreal compensation,
const KoColorSpace * colorspace )
inline

Member Function Documentation

◆ transform()

template<typename _lab_channels_type_ >
void KoLabDarkenColorTransformation< _lab_channels_type_ >::transform ( const quint8 * src,
quint8 * dst,
qint32 nPixels ) const
inlineoverridevirtual

This function apply the transformation on a given number of pixels.

Parameters
srca pointer to the source pixels
dsta pointer to the destination pixels
nPixelsthe number of pixels

This function may or may not be thread safe. You need to create one KoColorTransformation per thread.

Implements KoColorTransformation.

Definition at line 28 of file KoLabDarkenColorTransformation.h.

29 {
30 *((quint32 *)dst) = *((const quint32 *)src);
31
32 QColor c;
33
34 for (unsigned int i = 0; i < nPixels*m_colorSpace->pixelSize(); i+=m_colorSpace->pixelSize()) {
35 if (m_compensate) {
36 m_colorSpace->toQColor(src+i,&c);
37 c.setRed((c.red()*m_shade)/(m_compensation*255));
38 c.setGreen((c.green()*m_shade)/(m_compensation*255));
39 c.setBlue((c.blue()*m_shade)/(m_compensation*255));
40 m_colorSpace->fromQColor(c,dst+i);
41 } else {
42 m_colorSpace->toQColor(src+i,&c);
43 c.setRed((c.red()*m_shade)/255);
44 c.setGreen((c.green()*m_shade)/255);
45 c.setBlue((c.blue()*m_shade)/255);
46 m_colorSpace->fromQColor(c,dst+i);
47 }
48 }
49 }
virtual quint32 pixelSize() const =0
virtual void toQColor(const quint8 *src, QColor *c) const =0
virtual void fromQColor(const QColor &color, quint8 *dst) const =0

References KoColorSpace::fromQColor(), KoLabDarkenColorTransformation< _lab_channels_type_ >::m_colorSpace, KoLabDarkenColorTransformation< _lab_channels_type_ >::m_compensate, KoLabDarkenColorTransformation< _lab_channels_type_ >::m_compensation, KoLabDarkenColorTransformation< _lab_channels_type_ >::m_shade, KoColorSpace::pixelSize(), and KoColorSpace::toQColor().

Member Data Documentation

◆ m_colorSpace

template<typename _lab_channels_type_ >
const KoColorSpace* KoLabDarkenColorTransformation< _lab_channels_type_ >::m_colorSpace {0}

Definition at line 50 of file KoLabDarkenColorTransformation.h.

50{0};

◆ m_compensate

template<typename _lab_channels_type_ >
bool KoLabDarkenColorTransformation< _lab_channels_type_ >::m_compensate {false}

Definition at line 54 of file KoLabDarkenColorTransformation.h.

54{false};

◆ m_compensation

template<typename _lab_channels_type_ >
qreal KoLabDarkenColorTransformation< _lab_channels_type_ >::m_compensation {0.0}

Definition at line 55 of file KoLabDarkenColorTransformation.h.

55{0.0};

◆ m_defaultFromLab

template<typename _lab_channels_type_ >
const KoColorConversionTransformation* KoLabDarkenColorTransformation< _lab_channels_type_ >::m_defaultFromLab {0}

Definition at line 52 of file KoLabDarkenColorTransformation.h.

52{0};

◆ m_defaultToLab

template<typename _lab_channels_type_ >
const KoColorConversionTransformation* KoLabDarkenColorTransformation< _lab_channels_type_ >::m_defaultToLab {0}

Definition at line 51 of file KoLabDarkenColorTransformation.h.

51{0};

◆ m_shade

template<typename _lab_channels_type_ >
qint32 KoLabDarkenColorTransformation< _lab_channels_type_ >::m_shade {0}

Definition at line 53 of file KoLabDarkenColorTransformation.h.

53{0};

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