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

Public Member Functions

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

double m_cyan_highlights {0.0}
 
double m_cyan_midtones {0.0}
 
double m_cyan_shadows {0.0}
 
double m_magenta_highlights {0.0}
 
double m_magenta_midtones {0.0}
 
double m_magenta_shadows {0.0}
 
bool m_preserve_luminosity {true}
 
double m_yellow_highlights {0.0}
 
double m_yellow_midtones {0.0}
 
double m_yellow_shadows {0.0}
 

Detailed Description

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

Definition at line 30 of file kis_color_balance_adjustment.cpp.

Member Typedef Documentation

◆ RGBPixel

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

Definition at line 33 of file kis_color_balance_adjustment.cpp.

◆ RGBTrait

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

Definition at line 32 of file kis_color_balance_adjustment.cpp.

Constructor & Destructor Documentation

◆ KisColorBalanceAdjustment()

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

Definition at line 36 of file kis_color_balance_adjustment.cpp.

36{}

Member Function Documentation

◆ parameterId()

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

Get the parameter id for a parameter name

Reimplemented from KoColorTransformation.

Definition at line 83 of file kis_color_balance_adjustment.cpp.

84{
85 if (name == "cyan_red_midtones")
86 return 0;
87 else if(name == "magenta_green_midtones")
88 return 1;
89 else if(name == "yellow_blue_midtones")
90 return 2;
91 else if (name == "cyan_red_shadows")
92 return 3;
93 else if(name == "magenta_green_shadows")
94 return 4;
95 else if(name == "yellow_blue_shadows")
96 return 5;
97 else if (name == "cyan_red_highlights")
98 return 6;
99 else if(name == "magenta_green_highlights")
100 return 7;
101 else if(name == "yellow_blue_highlights")
102 return 8;
103 else if(name == "preserve_luminosity")
104 return 9;
105 return -1;
106}

◆ parameters()

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

Reimplemented from KoColorTransformation.

Definition at line 74 of file kis_color_balance_adjustment.cpp.

75{
76 QList<QString> list;
77 list << "cyan_red_midtones" << "magenta_green_midtones" << "yellow_blue_midtones"
78 << "cyan_red_shadows" << "magenta_green_shadows" << "yellow_blue_shadows"
79 << "cyan_red_highlights" << "magenta_green_highlights" << "yellow_blue_highlights" << "preserve_luminosity";
80 return list;
81}

◆ setParameter()

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

Update one parameter of a cached transformation object.

Reimplemented from KoColorTransformation.

Definition at line 108 of file kis_color_balance_adjustment.cpp.

109{
110 switch(id)
111 {
112 case 0:
113 m_cyan_midtones = parameter.toDouble();
114 break;
115 case 1:
116 m_magenta_midtones = parameter.toDouble();
117 break;
118 case 2:
119 m_yellow_midtones = parameter.toDouble();
120 break;
121 case 3:
122 m_cyan_shadows = parameter.toDouble();
123 break;
124 case 4:
125 m_magenta_shadows = parameter.toDouble();
126 break;
127 case 5:
128 m_yellow_shadows = parameter.toDouble();
129 break;
130 case 6:
131 m_cyan_highlights = parameter.toDouble();
132 break;
133 case 7:
134 m_magenta_highlights = parameter.toDouble();
135 break;
136 case 8:
137 m_yellow_highlights = parameter.toDouble();
138 break;
139 case 9:
140 m_preserve_luminosity = parameter.toBool();
141 break;
142 default:
143 ;
144 }
145}

References KisColorBalanceAdjustment< _channel_type_, traits >::m_cyan_highlights, KisColorBalanceAdjustment< _channel_type_, traits >::m_cyan_midtones, KisColorBalanceAdjustment< _channel_type_, traits >::m_cyan_shadows, KisColorBalanceAdjustment< _channel_type_, traits >::m_magenta_highlights, KisColorBalanceAdjustment< _channel_type_, traits >::m_magenta_midtones, KisColorBalanceAdjustment< _channel_type_, traits >::m_magenta_shadows, KisColorBalanceAdjustment< _channel_type_, traits >::m_preserve_luminosity, KisColorBalanceAdjustment< _channel_type_, traits >::m_yellow_highlights, KisColorBalanceAdjustment< _channel_type_, traits >::m_yellow_midtones, and KisColorBalanceAdjustment< _channel_type_, traits >::m_yellow_shadows.

◆ transform()

template<typename _channel_type_ , typename traits >
void KisColorBalanceAdjustment< _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 38 of file kis_color_balance_adjustment.cpp.

39{
41 const RGBPixel* src = reinterpret_cast<const RGBPixel*>(srcU8);
42 RGBPixel* dst = reinterpret_cast<RGBPixel*>(dstU8);
43 float value_red, value_green, value_blue, hue, saturation, lightness;
44
45 while(nPixels > 0) {
46
47 float red = SCALE_TO_FLOAT(src->red);
48 float green = SCALE_TO_FLOAT(src->green);
49 float blue = SCALE_TO_FLOAT(src->blue);
50 RGBToHSL(red, green, blue, &hue, &saturation, &lightness);
51
55
57 {
58 float h2, s2, l2;
59 RGBToHSL(value_red, value_green, value_blue, &h2, &s2, &l2);
60 HSLToRGB(h2, s2, lightness, &value_red, &value_green, &value_blue);
61 }
62 dst->red = SCALE_FROM_FLOAT(value_red);
63 dst->green = SCALE_FROM_FLOAT(value_green);
64 dst->blue = SCALE_FROM_FLOAT(value_blue);
65 dst->alpha = src->alpha;
66
67 --nPixels;
68 ++src;
69 ++dst;
70 }
71}
QPointF s2
void RGBToHSL(float r, float g, float b, float *h, float *s, float *l)
void HSLToRGB(float h, float sl, float l, float *r, float *g, float *b)
float colorBalanceTransform(float value, float lightness, float shadows, float midtones, float highlights)
#define SCALE_FROM_FLOAT(v)
#define SCALE_TO_FLOAT(v)

References KisColorBalanceMath::colorBalanceTransform(), HSLToRGB(), KisColorBalanceAdjustment< _channel_type_, traits >::m_cyan_highlights, KisColorBalanceAdjustment< _channel_type_, traits >::m_cyan_midtones, KisColorBalanceAdjustment< _channel_type_, traits >::m_cyan_shadows, KisColorBalanceAdjustment< _channel_type_, traits >::m_magenta_highlights, KisColorBalanceAdjustment< _channel_type_, traits >::m_magenta_midtones, KisColorBalanceAdjustment< _channel_type_, traits >::m_magenta_shadows, KisColorBalanceAdjustment< _channel_type_, traits >::m_preserve_luminosity, KisColorBalanceAdjustment< _channel_type_, traits >::m_yellow_highlights, KisColorBalanceAdjustment< _channel_type_, traits >::m_yellow_midtones, KisColorBalanceAdjustment< _channel_type_, traits >::m_yellow_shadows, RGBToHSL(), s2, SCALE_FROM_FLOAT, and SCALE_TO_FLOAT.

Member Data Documentation

◆ m_cyan_highlights

template<typename _channel_type_ , typename traits >
double KisColorBalanceAdjustment< _channel_type_, traits >::m_cyan_highlights {0.0}
private

Definition at line 154 of file kis_color_balance_adjustment.cpp.

154{0.0};

◆ m_cyan_midtones

template<typename _channel_type_ , typename traits >
double KisColorBalanceAdjustment< _channel_type_, traits >::m_cyan_midtones {0.0}
private

Definition at line 148 of file kis_color_balance_adjustment.cpp.

148{0.0};

◆ m_cyan_shadows

template<typename _channel_type_ , typename traits >
double KisColorBalanceAdjustment< _channel_type_, traits >::m_cyan_shadows {0.0}
private

Definition at line 151 of file kis_color_balance_adjustment.cpp.

151{0.0};

◆ m_magenta_highlights

template<typename _channel_type_ , typename traits >
double KisColorBalanceAdjustment< _channel_type_, traits >::m_magenta_highlights {0.0}
private

Definition at line 155 of file kis_color_balance_adjustment.cpp.

155{0.0};

◆ m_magenta_midtones

template<typename _channel_type_ , typename traits >
double KisColorBalanceAdjustment< _channel_type_, traits >::m_magenta_midtones {0.0}
private

Definition at line 149 of file kis_color_balance_adjustment.cpp.

149{0.0};

◆ m_magenta_shadows

template<typename _channel_type_ , typename traits >
double KisColorBalanceAdjustment< _channel_type_, traits >::m_magenta_shadows {0.0}
private

Definition at line 152 of file kis_color_balance_adjustment.cpp.

152{0.0};

◆ m_preserve_luminosity

template<typename _channel_type_ , typename traits >
bool KisColorBalanceAdjustment< _channel_type_, traits >::m_preserve_luminosity {true}
private

Definition at line 158 of file kis_color_balance_adjustment.cpp.

158{true};

◆ m_yellow_highlights

template<typename _channel_type_ , typename traits >
double KisColorBalanceAdjustment< _channel_type_, traits >::m_yellow_highlights {0.0}
private

Definition at line 156 of file kis_color_balance_adjustment.cpp.

156{0.0};

◆ m_yellow_midtones

template<typename _channel_type_ , typename traits >
double KisColorBalanceAdjustment< _channel_type_, traits >::m_yellow_midtones {0.0}
private

Definition at line 150 of file kis_color_balance_adjustment.cpp.

150{0.0};

◆ m_yellow_shadows

template<typename _channel_type_ , typename traits >
double KisColorBalanceAdjustment< _channel_type_, traits >::m_yellow_shadows {0.0}
private

Definition at line 153 of file kis_color_balance_adjustment.cpp.

153{0.0};

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