Krita Source Code Documentation
Loading...
Searching...
No Matches
KisScreentoneBrightnessContrastFunctions::BrightnessContrast Class Reference

#include <KisScreentoneBrightnessContrastFunctions.h>

Public Member Functions

 BrightnessContrast (qreal brightness, qreal contrast)
 
qreal operator() (qreal x) const
 

Private Attributes

qreal m_b
 
qreal m_m
 

Detailed Description

Definition at line 25 of file KisScreentoneBrightnessContrastFunctions.h.

Constructor & Destructor Documentation

◆ BrightnessContrast()

KisScreentoneBrightnessContrastFunctions::BrightnessContrast::BrightnessContrast ( qreal brightness,
qreal contrast )

Definition at line 13 of file KisScreentoneBrightnessContrastFunctions.cpp.

14{
15 if (contrast > 0.0) {
16 if (qFuzzyCompare(contrast, 1.0)) {
17 m_m = 10000.0;
18 } else {
19 m_m = 1.0 / (1.0 - contrast);
20 }
21 m_b = -m_m * (contrast / 2.0);
22 } else {
23 m_m = 1.0 + contrast;
24 m_b = -contrast / 2.0;
25 }
26 m_b += (1.0 - m_b) * brightness;
27}
static bool qFuzzyCompare(half p1, half p2)

References m_b, m_m, and qFuzzyCompare().

Member Function Documentation

◆ operator()()

qreal KisScreentoneBrightnessContrastFunctions::BrightnessContrast::operator() ( qreal x) const

Definition at line 29 of file KisScreentoneBrightnessContrastFunctions.cpp.

30{
31 return m_m * x + m_b;
32}

References m_b, and m_m.

Member Data Documentation

◆ m_b

qreal KisScreentoneBrightnessContrastFunctions::BrightnessContrast::m_b
private

Definition at line 32 of file KisScreentoneBrightnessContrastFunctions.h.

◆ m_m

qreal KisScreentoneBrightnessContrastFunctions::BrightnessContrast::m_m
private

Definition at line 32 of file KisScreentoneBrightnessContrastFunctions.h.


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