Krita Source Code Documentation
Loading...
Searching...
No Matches
KisColorBalanceMath Class Reference

#include <kis_color_balance_adjustment.h>

Public Member Functions

float colorBalanceTransform (float value, float lightness, float shadows, float midtones, float highlights)
 
 KisColorBalanceMath ()
 

Detailed Description

Definition at line 24 of file kis_color_balance_adjustment.h.

Constructor & Destructor Documentation

◆ KisColorBalanceMath()

KisColorBalanceMath::KisColorBalanceMath ( )

Definition at line 204 of file kis_color_balance_adjustment.cpp.

204{}

Member Function Documentation

◆ colorBalanceTransform()

float KisColorBalanceMath::colorBalanceTransform ( float value,
float lightness,
float shadows,
float midtones,
float highlights )

Definition at line 207 of file kis_color_balance_adjustment.cpp.

208{
209 static const float a = 0.25, b = 0.333, scale = 0.7;
210
211 shadows *= CLAMP ((lightness - b) / -a + 0.5, 0, 1) * scale;
212 midtones *= CLAMP ((lightness - b) / a + 0.5, 0, 1) * CLAMP ((lightness + b - 1) / -a + 0.5, 0, 1) * scale;
213 highlights *= CLAMP ((lightness + b - 1) / a + 0.5, 0, 1) * scale;
214
215 value += shadows;
216 value += midtones;
217 value += highlights;
218 value = CLAMP (value, 0.0, 1.0);
219
220 return value;
221}
float value(const T *src, size_t ch)
#define CLAMP(x, l, h)

References CLAMP, and value().


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