Krita Source Code Documentation
Loading...
Searching...
No Matches
KisColorFromGrayScaleFloat< _channel_type_, traits > Class Template Reference
+ Inheritance diagram for KisColorFromGrayScaleFloat< _channel_type_, traits >:

Public Member Functions

 KisColorFromGrayScaleFloat (float gmicUnitValue=255.0f)
 
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 ()
 

Private Types

using RGBPixel = typename RGBTrait::Pixel
 
using RGBTrait = traits
 

Private Attributes

float m_gmicUnitValue
 

Detailed Description

template<typename _channel_type_, typename traits>
class KisColorFromGrayScaleFloat< _channel_type_, traits >

Definition at line 114 of file kis_qmic_simple_convertor.cpp.

Member Typedef Documentation

◆ RGBPixel

template<typename _channel_type_ , typename traits >
using KisColorFromGrayScaleFloat< _channel_type_, traits >::RGBPixel = typename RGBTrait::Pixel
private

Definition at line 117 of file kis_qmic_simple_convertor.cpp.

◆ RGBTrait

template<typename _channel_type_ , typename traits >
using KisColorFromGrayScaleFloat< _channel_type_, traits >::RGBTrait = traits
private

Definition at line 116 of file kis_qmic_simple_convertor.cpp.

Constructor & Destructor Documentation

◆ KisColorFromGrayScaleFloat()

template<typename _channel_type_ , typename traits >
KisColorFromGrayScaleFloat< _channel_type_, traits >::KisColorFromGrayScaleFloat ( float gmicUnitValue = 255.0f)
inline

Definition at line 120 of file kis_qmic_simple_convertor.cpp.

121 : m_gmicUnitValue(gmicUnitValue)
122 {
123 }

Member Function Documentation

◆ transform()

template<typename _channel_type_ , typename traits >
void KisColorFromGrayScaleFloat< _channel_type_, traits >::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 126 of file kis_qmic_simple_convertor.cpp.

127 {
128 const auto *srcPixel =
129 reinterpret_cast<const KoRgbF32Traits::Pixel *>(src);
130 auto *dstPixel = reinterpret_cast<RGBPixel *>(dst);
131
132 const float gmicUnitValue2KritaUnitValue =
134 // warning: green and blue channels on input contain random data!!! see
135 // that we copy only one channel when gmic image has grayscale
136 // colorspace
137 while (nPixels > 0) {
138 dstPixel->red = dstPixel->green = dstPixel->blue =
139 SCALE_FROM_FLOAT(srcPixel->red * gmicUnitValue2KritaUnitValue);
140 dstPixel->alpha = SCALE_FROM_FLOAT(srcPixel->alpha
141 * gmicUnitValue2KritaUnitValue);
142
143 --nPixels;
144 ++srcPixel;
145 ++dstPixel;
146 }
147 }
#define SCALE_FROM_FLOAT(v)

References KisColorFromGrayScaleFloat< _channel_type_, traits >::m_gmicUnitValue, and SCALE_FROM_FLOAT.

Member Data Documentation

◆ m_gmicUnitValue

template<typename _channel_type_ , typename traits >
float KisColorFromGrayScaleFloat< _channel_type_, traits >::m_gmicUnitValue
private

Definition at line 150 of file kis_qmic_simple_convertor.cpp.


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