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

◆ blend8()

LIB8STATIC uint8_t blend8 ( uint8_t a,
uint8_t b,
uint8_t amountOfB )

Blend a variable proportion (0-255) of one byte to another.

Parameters
athe starting byte value
bthe byte value to blend toward
amountOfBthe proportion (0-255) of b to blend
Returns
a byte value between a and b, inclusive

Definition at line 667 of file math8.h.

667 {
668 // This version loses precision in the integer math
669 // and can actually return results outside of the range
670 // from a to b. Its use is not recommended.
671 uint8_t result;
672 uint8_t amountOfA = 255 - amountOfB;
673 result = scale8_LEAVING_R1_DIRTY(a, amountOfA) +
674 scale8_LEAVING_R1_DIRTY(b, amountOfB);
675 cleanup_R1();
676 return result;
677}
LIB8STATIC_ALWAYS_INLINE void cleanup_R1()
Clean up the r1 register after a series of *LEAVING_R1_DIRTY calls.
Definition scale8.h:333
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.
Definition scale8.h:170

References cleanup_R1(), LIB8STATIC, and scale8_LEAVING_R1_DIRTY().

Referenced by CRGB::blend(), and nblend().

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