521 {
522 if (blendType == LINEARBLEND_NOWRAP) {
523 index =
map8(index, 0, 247);
524
525 }
526
527 uint8_t hi5 = index;
528#if defined(__AVR__)
529 hi5 /= 2;
530 hi5 /= 2;
531 hi5 /= 2;
532#else
533 hi5 >>= 3;
534#endif
535 uint8_t lo3 = index & 0x07;
536
537
538
539
540
541 uint8_t hi5XsizeofCRGB = hi5 *
sizeof(
CRGB);
542
543 const CRGB *entry = (
CRGB *)((uint8_t *)(&(pal[0])) + hi5XsizeofCRGB);
544
545 uint8_t red1 = entry->red;
546 uint8_t green1 = entry->green;
547 uint8_t blue1 = entry->blue;
548
549 uint8_t
blend = lo3 && (blendType != NOBLEND);
550
552
553 if (hi5 == 31) {
554 entry = &(pal[0]);
555 } else {
556 ++entry;
557 }
558
559 uint8_t f2 = lo3 << 5;
560 uint8_t f1 = 255 - f2;
561
562 uint8_t red2 = entry->red;
565 red1 += red2;
566
567 uint8_t green2 = entry->green;
570 green1 += green2;
571
572 uint8_t blue2 = entry->blue;
575 blue1 += blue2;
576
578 }
579
583
584
585
586 if (red1) {
588#if !(FASTLED_SCALE8_FIXED == 1)
589 ++red1;
590#endif
591 }
592 if (green1) {
594#if !(FASTLED_SCALE8_FIXED == 1)
595 ++green1;
596#endif
597 }
598 if (blue1) {
600#if !(FASTLED_SCALE8_FIXED == 1)
601 ++blue1;
602#endif
603 }
605 } else {
606 red1 = 0;
607 green1 = 0;
608 blue1 = 0;
609 }
610 }
611
612 return CRGB(red1, green1, blue1);
613}
UISlider brightness("Brightness", 1, 0, 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.
Representation of an RGB pixel (Red, Green, Blue)