860 {
861 if (blendType == LINEARBLEND_NOWRAP) {
862 index =
map8(index, 0, 247);
863
864 }
865
867#if defined(__AVR__)
868 hi5 /= 2;
869 hi5 /= 2;
870 hi5 /= 2;
871#else
872 hi5 >>= 3;
873#endif
874 fl::u8 lo3 = index & 0x07;
875
877 const CHSV *entry = (
CHSV *)((
fl::u8 *)(&(pal[0])) + hi5XsizeofCHSV);
878
882
884
886
887 if (hi5 == 31) {
888 entry = &(pal[0]);
889 } else {
890 ++entry;
891 }
892
895
899
900
901
902
903
904
905
906
907
908
909
910
911 if (sat1 == 0 || val1 == 0) {
912 hue1 = hue2;
913 }
914
915
916
917 if (sat2 == 0 || val2 == 0) {
918 hue2 = hue1;
919 }
920
923
926
927
928
929
930 sat1 += sat2;
931 val1 += val2;
932
934 if (deltaHue & 0x80) {
935
936 hue1 -=
scale8(256 - deltaHue, f2);
937 } else {
938
939 hue1 +=
scale8(deltaHue, f2);
940 }
941
943 }
944
947 }
948
949 return CHSV(hue1, sat1, val1);
950}
UISlider brightness("Brightness", 128, 0, 255, 1)
CRGB blend(const CRGB &p1, const CRGB &p2, fract8 amountOfP2)
LIB8STATIC uint8_t map8(uint8_t in, uint8_t rangeStart, uint8_t rangeEnd)
Map from one full-range 8-bit value into a narrower range of 8-bit values, possibly a range of hues.
LIB8STATIC_ALWAYS_INLINE void cleanup_R1()
Clean up the r1 register after a series of *LEAVING_R1_DIRTY calls.
LIB8STATIC_ALWAYS_INLINE uint8_t scale8_LEAVING_R1_DIRTY(uint8_t i, fract8 scale)
This version of scale8() does not clean up the R1 register on AVR.
LIB8STATIC_ALWAYS_INLINE uint8_t scale8_video(uint8_t i, fract8 scale)
The "video" version of scale8() guarantees that the output will be only be zero if one or both of the...
LIB8STATIC_ALWAYS_INLINE uint8_t scale8(uint8_t i, fract8 scale)
Scale one byte by a second one, which is treated as the numerator of a fraction whose denominator is ...
Representation of an HSV pixel (hue, saturation, value (aka brightness)).