hyperion.ng
RgbTransform.h
1 #pragma once
2 
3 // STL includes
4 #include <cstdint>
5 
10 {
11 public:
15  RgbTransform();
16 
27  RgbTransform(double gammaR, double gammaG, double gammaB, double backlightThreshold, bool backlightColored, uint8_t brightness, uint8_t brightnessCompensation);
28 
32  ~RgbTransform();
33 
35  double getGammaR() const;
36 
38  double getGammaG() const;
39 
41  double getGammaB() const;
42 
46  void setGamma(double gammaR,double gammaG=-1, double gammaB=-1);
47 
49  int getBacklightThreshold() const;
50 
52  void setBacklightThreshold(int backlightThreshold);
53 
55  bool getBacklightColored() const;
56 
58  void setBacklightColored(bool backlightColored);
59 
61  bool getBackLightEnabled() const;
62 
64  void setBackLightEnabled(bool enable);
65 
67  uint8_t getBrightness() const;
68 
70  void setBrightness(uint8_t brightness);
71 
73  uint8_t getBrightnessCompensation() const;
74 
76  void setBrightnessCompensation(uint8_t brightnessCompensation);
77 
87  void getBrightnessComponents(uint8_t & rgb, uint8_t & cmy, uint8_t & w );
88 
98  void transform(uint8_t & red, uint8_t & green, uint8_t & blue);
99 
100 private:
112  void init(double gammaR, double gammaG, double gammaB, double backlightThreshold, bool backlightColored, uint8_t brightness, uint8_t brightnessCompensation);
113 
115  void initializeMapping();
116 
117  void updateBrightnessComponents();
118 
120  bool _backLightEnabled
121  , _backlightColored;
122  double _backlightThreshold
123  , _sumBrightnessLow;
124 
126  double _gammaR
127  , _gammaG
128  , _gammaB;
129 
131  uint8_t _mappingR[256]
132  , _mappingG[256]
133  , _mappingB[256];
134 
136  uint8_t _brightness
137  , _brightnessCompensation
138  , _brightness_rgb
139  , _brightness_cmy
140  , _brightness_w;
141 };
bool getBackLightEnabled() const
Definition: RgbTransform.cpp:84
RgbTransform()
Default constructor.
Definition: RgbTransform.cpp:4
double getGammaB() const
Definition: RgbTransform.cpp:39
Color transformation to adjust the saturation and value of a RGB color value.
Definition: RgbTransform.h:9
double getGammaR() const
Definition: RgbTransform.cpp:29
~RgbTransform()
Destructor.
Definition: RgbTransform.cpp:25
void setBackLightEnabled(bool enable)
Definition: RgbTransform.cpp:89
void setGamma(double gammaR, double gammaG=-1, double gammaB=-1)
Definition: RgbTransform.cpp:44
double getGammaG() const
Definition: RgbTransform.cpp:34
void getBrightnessComponents(uint8_t &rgb, uint8_t &cmy, uint8_t &w)
get component values of brightness for compensated brightness
Definition: RgbTransform.cpp:136
void setBrightness(uint8_t brightness)
Definition: RgbTransform.cpp:99
uint8_t getBrightness() const
Definition: RgbTransform.cpp:94
void setBrightnessCompensation(uint8_t brightnessCompensation)
Definition: RgbTransform.cpp:105
void setBacklightThreshold(int backlightThreshold)
Definition: RgbTransform.cpp:68
int getBacklightThreshold() const
Definition: RgbTransform.cpp:63
void setBacklightColored(bool backlightColored)
Definition: RgbTransform.cpp:79
uint8_t getBrightnessCompensation() const
Definition: RgbTransform.cpp:111
bool getBacklightColored() const
Definition: RgbTransform.cpp:74
void transform(uint8_t &red, uint8_t &green, uint8_t &blue)
Apply the transform the the given RGB values.
Definition: RgbTransform.cpp:143