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

Public Member Functions

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

Definition at line 72 of file kis_qmic_simple_convertor.cpp.

Member Typedef Documentation

◆ RGBPixel

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

Definition at line 75 of file kis_qmic_simple_convertor.cpp.

◆ RGBTrait

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

Definition at line 74 of file kis_qmic_simple_convertor.cpp.

Constructor & Destructor Documentation

◆ KisColorFromFloat()

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

Definition at line 78 of file kis_qmic_simple_convertor.cpp.

79 : m_gmicUnitValue(gmicUnitValue)
80 {
81 }

Member Function Documentation

◆ transform()

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

85 {
86 const auto *srcPixel =
87 reinterpret_cast<const KoRgbF32Traits::Pixel *>(src);
88 auto *dstPixel = reinterpret_cast<RGBPixel *>(dst);
89
90 const float gmicUnitValue2KritaUnitValue =
92
93 while (nPixels > 0) {
94 dstPixel->red =
95 SCALE_FROM_FLOAT(srcPixel->red * gmicUnitValue2KritaUnitValue);
96 dstPixel->green = SCALE_FROM_FLOAT(srcPixel->green
97 * gmicUnitValue2KritaUnitValue);
98 dstPixel->blue =
99 SCALE_FROM_FLOAT(srcPixel->blue * gmicUnitValue2KritaUnitValue);
100 dstPixel->alpha = SCALE_FROM_FLOAT(srcPixel->alpha
101 * gmicUnitValue2KritaUnitValue);
102
103 --nPixels;
104 ++srcPixel;
105 ++dstPixel;
106 }
107 }
typename RGBTrait::Pixel RGBPixel
#define SCALE_FROM_FLOAT(v)

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

Member Data Documentation

◆ m_gmicUnitValue

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

Definition at line 110 of file kis_qmic_simple_convertor.cpp.


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