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

Public Member Functions

 KisColorFromGrayScaleAlphaFloat (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 KisColorFromGrayScaleAlphaFloat< _channel_type_, traits >

Definition at line 154 of file kis_qmic_simple_convertor.cpp.

Member Typedef Documentation

◆ RGBPixel

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

Definition at line 157 of file kis_qmic_simple_convertor.cpp.

◆ RGBTrait

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

Definition at line 156 of file kis_qmic_simple_convertor.cpp.

Constructor & Destructor Documentation

◆ KisColorFromGrayScaleAlphaFloat()

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

Definition at line 160 of file kis_qmic_simple_convertor.cpp.

161 : m_gmicUnitValue(gmicUnitValue)
162 {
163 }

Member Function Documentation

◆ transform()

template<typename _channel_type_ , typename traits >
void KisColorFromGrayScaleAlphaFloat< _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 166 of file kis_qmic_simple_convertor.cpp.

167 {
168 const auto *srcPixel =
169 reinterpret_cast<const KoRgbF32Traits::Pixel *>(src);
170 auto *dstPixel = reinterpret_cast<RGBPixel *>(dst);
171
172 const float gmicUnitValue2KritaUnitValue =
174 // warning: green and blue channels on input contain random data!!! see
175 // that we copy only one channel when gmic image has grayscale
176 // colorspace
177 while (nPixels > 0) {
178 dstPixel->red = dstPixel->green = dstPixel->blue =
179 SCALE_FROM_FLOAT(srcPixel->red * gmicUnitValue2KritaUnitValue);
180 dstPixel->alpha = SCALE_FROM_FLOAT(srcPixel->green
181 * gmicUnitValue2KritaUnitValue);
182
183 --nPixels;
184 ++srcPixel;
185 ++dstPixel;
186 }
187 }
#define SCALE_FROM_FLOAT(v)

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

Member Data Documentation

◆ m_gmicUnitValue

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

Definition at line 190 of file kis_qmic_simple_convertor.cpp.


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