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

◆ hsv2rgb_fullspectrum() [2/3]

void hsv2rgb_fullspectrum ( const struct CHSV & hsv,
CRGB & rgb )

Definition at line 494 of file hsv2rgb.cpp.

494 {
495 const auto f = [](const int n, const uint8_t h) -> unsigned int {
496 constexpr int kZero = 0 << 8;
497 constexpr int kOne = 1 << 8;
498 constexpr int kFour = 4 << 8;
499 constexpr int kSix = 6 << 8;
500
501 const int k = ((n << 8) + 6*h) % kSix;
502 const int k2 = kFour - k;
503 return fl::fl_max(kZero, fl::fl_min(kOne, fl::fl_min(k, k2)));
504 };
505
506 const unsigned int chroma = hsv.v * hsv.s / 255;
507 rgb.r = hsv.v - ((chroma * f(5, hsv.h)) >> 8);
508 rgb.g = hsv.v - ((chroma * f(3, hsv.h)) >> 8);
509 rgb.b = hsv.v - ((chroma * f(1, hsv.h)) >> 8);
510}
FL_DISABLE_WARNING_PUSH U common_type_t< T, U > fl_min(T a, U b)
Definition math_macros.h:25
common_type_t< T, U > fl_max(T a, U b)
Definition math_macros.h:29

References fl::fl_max(), and fl::fl_min().

Referenced by hsv2rgb_dispatch(), hsv2rgb_dispatch(), hsv2rgb_fullspectrum(), hsv2rgb_fullspectrum(), and loop().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: