26 Color() : red_(0.f), green_(0.f), blue_(0.f) {}
27 Color(
float r,
float g,
float b) : red_(r), green_(g), blue_(b) {}
55 void Init(
float red,
float green,
float blue);
58 inline float Red()
const {
return red_; }
61 inline float Green()
const {
return green_; }
64 inline float Blue()
const {
return blue_; }
66 inline uint8_t
Red8()
const {
return red_ * 255; }
67 inline uint8_t
Green8()
const {
return green_ * 255; }
68 inline uint8_t
Blue8()
const {
return blue_ * 255; }
70 inline void SetRed(
const float amt) { red_ = amt; }
71 inline void SetGreen(
const float amt) { green_ = amt; }
72 inline void SetBlue(
const float amt) { blue_ = amt; }
78 c.
Init(red_ * scale, green_ * scale, blue_ * scale);
85 float r_ = red_ + rhs.
Red();
86 float g_ = green_ + rhs.
Green();
87 float b_ = blue_ + rhs.
Blue();
101 float scalar = amt > 1.f ? 1.f : amt < 0.f ? 0.f : amt;
102 float nr = a.
Red() + (b.
Red() - a.
Red()) * scalar;
106 Color new_color(nr, ng, nb);
112 static const float standard_colors[
LAST][3];
113 float red_, green_, blue_;
Color(float r, float g, float b)
Definition color.h:27
void SetBlue(const float amt)
Definition color.h:72
void Init(float red, float green, float blue)
Color()
Definition color.h:26
void SetGreen(const float amt)
Definition color.h:71
void SetRed(const float amt)
Definition color.h:70
float Green() const
Definition color.h:61
float Blue() const
Definition color.h:64
static Color Blend(const Color a, const Color b, const float amt)
Definition color.h:99
Color operator*(float scale)
Definition color.h:75
uint8_t Green8() const
Definition color.h:67
float Red() const
Definition color.h:58
uint8_t Blue8() const
Definition color.h:68
~Color()
Definition color.h:28
Color operator+(Color rhs)
Definition color.h:83
uint8_t Red8() const
Definition color.h:66
PresetColor
Definition color.h:32
@ GOLD
Definition color.h:39
@ GREEN
Definition color.h:34
@ LAST
Definition color.h:41
@ BLUE
Definition color.h:35
@ OFF
Definition color.h:40
@ WHITE
Definition color.h:36
@ RED
Definition color.h:33
@ CYAN
Definition color.h:38
@ PURPLE
Definition color.h:37
Hardware defines and helpers for daisy field platform.
Definition index.h:2