BeeeOn Gateway  v2020.3.1-2-g6f737dc
Platform to interconnect the IoT world
ColorBrightness.h
1 #pragma once
2 
3 #include <cstdint>
4 
5 namespace BeeeOn {
6 
12 public:
17  const uint8_t red,
18  const uint8_t green,
19  const uint8_t blue,
20  const uint8_t maxColorElement = 0xff);
21 
25  uint8_t brightness() const;
26 
32  void setBrightness(const uint8_t brightness);
33 
34  uint8_t red() const;
35  uint8_t green() const;
36  uint8_t blue() const;
37 
42  void setColor(
43  const uint8_t red,
44  const uint8_t green,
45  const uint8_t blue);
46 
47 private:
52  void assertValidColor(
53  const uint8_t red,
54  const uint8_t green,
55  const uint8_t blue) const;
56 
61  void deriveBrightness(
62  const uint8_t red,
63  const uint8_t green,
64  const uint8_t blue);
65 
70  void normalizeColor(
71  const uint8_t red,
72  const uint8_t green,
73  const uint8_t blue);
74 
79  uint8_t brightnessFromColor(const uint8_t component) const;
80 
84  uint8_t omitBrightness(const uint8_t component) const;
85 
89  uint8_t applyBrightness(const uint8_t component) const;
90 
91 private:
92  uint8_t m_red;
93  uint8_t m_green;
94  uint8_t m_blue;
95  uint8_t m_brightness;
96 
97  uint8_t m_maxColorElement;
98 };
99 
100 }
ColorBrightness(const uint8_t red, const uint8_t green, const uint8_t blue, const uint8_t maxColorElement=0xff)
Definition: ColorBrightness.cpp:12
void setColor(const uint8_t red, const uint8_t green, const uint8_t blue)
Definition: ColorBrightness.cpp:50
void setBrightness(const uint8_t brightness)
Definition: ColorBrightness.cpp:27
uint8_t brightness() const
Returns brightness in percents.
Definition: ColorBrightness.cpp:22
The class stores color represent by red, green and blue component. It allows to count the brightness ...
Definition: ColorBrightness.h:11