MCPcopy Create free account
hub / github.com/FastLED/FastLED / ToRGB

Method ToRGB

examples/LuminescentGrand/shared/color.cpp:129–151  ·  view source on GitHub ↗

//////////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

127
128///////////////////////////////////////////////////////////////////////////////
129Color3i ColorHSV::ToRGB() const {
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}

Callers 5

PaintMethod · 0.45
PaintVuNotesMethod · 0.45
PaintVuMidNotesFadeMethod · 0.45
VegasVisualizerMethod · 0.45
PaintBrightSurpriseMethod · 0.45

Calls 2

roundFunction · 0.85
Color3iClass · 0.70

Tested by

no test coverage detected