FastLED 3.10.6
Loading...
Searching...
No Matches

◆ nblend() [3/4]

CRGB & fl::nblend ( CRGB & existing,
const CRGB & overlay,
fract8 amountOfOverlay )

Definition at line 87 of file colorutils.cpp.hpp.

87 {
88 if (amountOfOverlay == 0) {
89 return existing;
90 }
91
92 if (amountOfOverlay == 255) {
93 existing = overlay;
94 return existing;
95 }
96
97#if 0
98 // Old blend method which unfortunately had some rounding errors
99 fract8 amountOfKeep = 255 - amountOfOverlay;
100
101 existing.red = scale8_LEAVING_R1_DIRTY( existing.red, amountOfKeep)
102 + scale8_LEAVING_R1_DIRTY( overlay.red, amountOfOverlay);
103 existing.green = scale8_LEAVING_R1_DIRTY( existing.green, amountOfKeep)
104 + scale8_LEAVING_R1_DIRTY( overlay.green, amountOfOverlay);
105 existing.blue = scale8_LEAVING_R1_DIRTY( existing.blue, amountOfKeep)
106 + scale8_LEAVING_R1_DIRTY( overlay.blue, amountOfOverlay);
107
108 cleanup_R1();
109#else
110 // Corrected blend method, with no loss-of-precision rounding errors
111 existing.red = blend8(existing.red, overlay.red, amountOfOverlay);
112 existing.green = blend8(existing.green, overlay.green, amountOfOverlay);
113 existing.blue = blend8(existing.blue, overlay.blue, amountOfOverlay);
114#endif
115
116 return existing;
117}
u8 fract8
Fixed-Point Fractional Types.
Definition stdint.h:160

Referenced by blend(), blend(), fl::Pride2015::draw(), FL_DISABLE_WARNING(), nblend(), and nblend().

+ Here is the caller graph for this function: