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

Public Member Functions

 KisColorToFloatConvertor (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 ()
 

Public Attributes

float m_gmicUnitValue
 

Private Types

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

Detailed Description

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

Definition at line 32 of file kis_qmic_simple_convertor.cpp.

Member Typedef Documentation

◆ RGBPixel

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

Definition at line 35 of file kis_qmic_simple_convertor.cpp.

◆ RGBTrait

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

Definition at line 34 of file kis_qmic_simple_convertor.cpp.

Constructor & Destructor Documentation

◆ KisColorToFloatConvertor()

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

Definition at line 38 of file kis_qmic_simple_convertor.cpp.

39 : m_gmicUnitValue(gmicUnitValue)
40 {
41 }

Member Function Documentation

◆ transform()

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

47 {
48 const float gmicUnitValue2KritaUnitValue =
50
51 const auto *srcPixel = reinterpret_cast<const RGBPixel *>(src);
52 auto *dstPixel = reinterpret_cast<KoRgbF32Traits::Pixel *>(dst);
53
54 while (nPixels > 0) {
55 dstPixel->red =
56 SCALE_TO_FLOAT(srcPixel->red) * gmicUnitValue2KritaUnitValue;
57 dstPixel->green =
58 SCALE_TO_FLOAT(srcPixel->green) * gmicUnitValue2KritaUnitValue;
59 dstPixel->blue =
60 SCALE_TO_FLOAT(srcPixel->blue) * gmicUnitValue2KritaUnitValue;
61 dstPixel->alpha =
62 SCALE_TO_FLOAT(srcPixel->alpha) * gmicUnitValue2KritaUnitValue;
63
64 --nPixels;
65 ++srcPixel;
66 ++dstPixel;
67 }
68 }
typename RGBTrait::Pixel RGBPixel
#define SCALE_TO_FLOAT(v)

References KisColorToFloatConvertor< _channel_type_, traits >::m_gmicUnitValue, and SCALE_TO_FLOAT.

Member Data Documentation

◆ m_gmicUnitValue

template<typename _channel_type_ , typename traits >
float KisColorToFloatConvertor< _channel_type_, traits >::m_gmicUnitValue

Definition at line 43 of file kis_qmic_simple_convertor.cpp.


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