MCPcopy Create free account
hub / github.com/FastLED/FastLED / blendAlphaMaxChannel

Method blendAlphaMaxChannel

src/crgb.cpp.hpp:59–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57}
58
59CRGB CRGB::blendAlphaMaxChannel(const CRGB &upper, const CRGB &lower) {
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}
72
73void CRGB::downscale(const CRGB *src, const fl::XYMap &srcXY, CRGB *dst,
74 const fl::XYMap &dstXY) {

Callers

nothing calls this directly

Calls 1

blendFunction · 0.50

Tested by

no test coverage detected