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

Public Member Functions

 KisBurnShadowsAdjustment ()
 
int parameterId (const QString &name) const override
 
QList< QString > parameters () const override
 
void setParameter (int id, const QVariant &parameter) override
 
void transform (const quint8 *srcU8, quint8 *dstU8, qint32 nPixels) const override
 
- Public Member Functions inherited from KoColorTransformation
virtual bool isValid () const
 
void setParameters (const QHash< QString, QVariant > &parameters)
 
virtual ~KoColorTransformation ()
 

Private Types

typedef RGBTrait::Pixel RGBPixel
 
typedef traits RGBTrait
 

Private Attributes

float exposure {0.0f}
 

Detailed Description

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

Definition at line 24 of file kis_burnshadows_adjustment.cpp.

Member Typedef Documentation

◆ RGBPixel

template<typename _channel_type_ , typename traits >
typedef RGBTrait::Pixel KisBurnShadowsAdjustment< _channel_type_, traits >::RGBPixel
private

Definition at line 27 of file kis_burnshadows_adjustment.cpp.

◆ RGBTrait

template<typename _channel_type_ , typename traits >
typedef traits KisBurnShadowsAdjustment< _channel_type_, traits >::RGBTrait
private

Definition at line 26 of file kis_burnshadows_adjustment.cpp.

Constructor & Destructor Documentation

◆ KisBurnShadowsAdjustment()

template<typename _channel_type_ , typename traits >
KisBurnShadowsAdjustment< _channel_type_, traits >::KisBurnShadowsAdjustment ( )
inline

Definition at line 30 of file kis_burnshadows_adjustment.cpp.

30{}

Member Function Documentation

◆ parameterId()

template<typename _channel_type_ , typename traits >
int KisBurnShadowsAdjustment< _channel_type_, traits >::parameterId ( const QString & name) const
inlineoverridevirtual

Get the parameter id for a parameter name

Reimplemented from KoColorTransformation.

Definition at line 69 of file kis_burnshadows_adjustment.cpp.

70 {
71 if (name == "exposure")
72 return 0;
73 return -1;
74 }

◆ parameters()

template<typename _channel_type_ , typename traits >
QList< QString > KisBurnShadowsAdjustment< _channel_type_, traits >::parameters ( ) const
inlineoverridevirtual
Returns
the list of parameters

Reimplemented from KoColorTransformation.

Definition at line 62 of file kis_burnshadows_adjustment.cpp.

63 {
64 QList<QString> list;
65 list << "exposure";
66 return list;
67 }

◆ setParameter()

template<typename _channel_type_ , typename traits >
void KisBurnShadowsAdjustment< _channel_type_, traits >::setParameter ( int id,
const QVariant & parameter )
inlineoverridevirtual

Update one parameter of a cached transformation object.

Reimplemented from KoColorTransformation.

Definition at line 76 of file kis_burnshadows_adjustment.cpp.

77 {
78 switch(id)
79 {
80 case 0:
81 exposure = parameter.toDouble();
82 break;
83 default:
84 ;
85 }
86 }

References KisBurnShadowsAdjustment< _channel_type_, traits >::exposure.

◆ transform()

template<typename _channel_type_ , typename traits >
void KisBurnShadowsAdjustment< _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 32 of file kis_burnshadows_adjustment.cpp.

33 {
34 const RGBPixel* src = reinterpret_cast<const RGBPixel*>(srcU8);
35 RGBPixel* dst = reinterpret_cast<RGBPixel*>(dstU8);
36 float value_red, value_green, value_blue, new_value_red, new_value_green, new_value_blue;
37 const float factor(exposure * 0.333333);
38 while (nPixels > 0) {
39
43
44 if( value_red < factor ) new_value_red = 0;
45 else new_value_red = (value_red - factor)/(1 - factor);
46 if( value_green < factor ) new_value_green = 0;
47 else new_value_green = (value_green - factor)/(1 - factor);
48 if( value_blue < factor ) new_value_blue = 0;
49 else new_value_blue = (value_blue - factor)/(1 - factor);
50
52 dst->green = KoColorSpaceMaths< float, _channel_type_ >::scaleToA(new_value_green);
54 dst->alpha = src->alpha;
55
56 --nPixels;
57 ++src;
58 ++dst;
59 }
60 }
static _Tdst scaleToA(_T a)

References KisBurnShadowsAdjustment< _channel_type_, traits >::exposure, and KoColorSpaceMaths< _T, _Tdst >::scaleToA().

Member Data Documentation

◆ exposure

template<typename _channel_type_ , typename traits >
float KisBurnShadowsAdjustment< _channel_type_, traits >::exposure {0.0f}
private

Definition at line 89 of file kis_burnshadows_adjustment.cpp.

89{0.0f};

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