FastLED 3.9.15
Loading...
Searching...
No Matches

◆ ToRGB()

Color3i ColorHSV::ToRGB ( ) const

Definition at line 128 of file color.cpp.

128 {
129 typedef double FloatT;
130 FloatT r = 0;
131 FloatT g = 0;
132 FloatT b = 0;
133
134 int i = int(h_ * 6);
135 FloatT f = h_ * 6.0 - static_cast<FloatT>(i);
136 FloatT p = v_ * (1.0 - s_);
137 FloatT q = v_ * (1.0 - f * s_);
138 FloatT t = v_ * (1.0 - (1.0 - f) * s_);
139
140 switch(i % 6){
141 case 0: r = v_, g = t, b = p; break;
142 case 1: r = q, g = v_, b = p; break;
143 case 2: r = p, g = v_, b = t; break;
144 case 3: r = p, g = q, b = v_; break;
145 case 4: r = t, g = p, b = v_; break;
146 case 5: r = v_, g = p, b = q; break;
147 }
148
149 return Color3i(round(r * 255), round(g * 255), round(b * 255));
150}
static FASTLED_NAMESPACE_BEGIN uint8_t const p[]
Definition noise.cpp:56
float v_
Definition color.h:98
float h_
Definition color.h:98
float s_
Definition color.h:98
#define round(x)
Definition util.h:10

References h_, p, round, s_, and v_.

Referenced by Painter::Paint(), Painter::PaintBrightSurprise(), Painter::PaintVuMidNotesFade(), Painter::PaintVuNotes(), and Painter::VegasVisualizer().

+ Here is the caller graph for this function: