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

◆ ToRGB()

Color3i ColorHSV::ToRGB ( ) const

Definition at line 129 of file color.cpp.

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

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

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

+ Here is the caller graph for this function: