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

◆ blendAlphaMaxChannel()

CRGB CRGB::blendAlphaMaxChannel ( const CRGB & upper,
const CRGB & lower )
static

Definition at line 59 of file crgb.cpp.hpp.

59 {
60 // Use luma of upper pixel as alpha (0..255)
61 fl::u8 max_component = 0;
62 for (int i = 0; i < 3; ++i) {
63 if (upper.raw[i] > max_component) {
64 max_component = upper.raw[i];
65 }
66 }
67 // uint8_t alpha = upper.getLuma();
68 // blend(lower, upper, alpha) → (lower * (255−alpha) + upper * alpha) / 256
69 fl::u8 amountOf2 = 255 - max_component;
70 return CRGB::blend(upper, lower, amountOf2);
71}
unsigned char u8
Definition s16x16x4.h:132
static CRGB blend(const CRGB &p1, const CRGB &p2, fract8 amountOfP2) FL_NOEXCEPT
Definition crgb.cpp.hpp:54

References CRGB(), and blend().

Referenced by fl::Frame::draw(), fl::XYDrawComposited::draw(), and fl::Frame::drawXY().

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