773 {
774 if (blendType == LINEARBLEND_NOWRAP) {
775 index =
map8(index, 0, 239);
776
777 }
778
779
781 fl::u8 lo4 = index & 0x0F;
782
783
784 const CHSV *entry = &(pal[0]) + hi4;
785
789
791
793
794 if (hi4 == 15) {
795 entry = &(pal[0]);
796 } else {
797 ++entry;
798 }
799
802
806
807
808
809
810
811
812
813
814
815
816
817
818 if (sat1 == 0 || val1 == 0) {
819 hue1 = hue2;
820 }
821
822
823
824 if (sat2 == 0 || val2 == 0) {
825 hue2 = hue1;
826 }
827
830
833
834
835
836
837 sat1 += sat2;
838 val1 += val2;
839
841 if (deltaHue & 0x80) {
842
843 hue1 -=
scale8(256 - deltaHue, f2);
844 } else {
845
846 hue1 +=
scale8(deltaHue, f2);
847 }
848
850 }
851
854 }
855
856 return CHSV(hue1, sat1, val1);
857}
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 ...
fl::u8 lsrX4(fl::u8 dividend)
Helper function to divide a number by 16, aka four logical shift right (LSR)'s.
Representation of an HSV pixel (hue, saturation, value (aka brightness)).