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

◆ nblend() [3/4]

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

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

22 {
23 if (amountOfOverlay == 0) {
24 return existing;
25 }
26
27 if (amountOfOverlay == 255) {
28 existing = overlay;
29 return existing;
30 }
31
32#if 0
33 // Old blend method which unfortunately had some rounding errors
34 fract8 amountOfKeep = 255 - amountOfOverlay;
35
36 existing.red = scale8_LEAVING_R1_DIRTY( existing.red, amountOfKeep)
37 + scale8_LEAVING_R1_DIRTY( overlay.red, amountOfOverlay);
38 existing.green = scale8_LEAVING_R1_DIRTY( existing.green, amountOfKeep)
39 + scale8_LEAVING_R1_DIRTY( overlay.green, amountOfOverlay);
40 existing.blue = scale8_LEAVING_R1_DIRTY( existing.blue, amountOfKeep)
41 + scale8_LEAVING_R1_DIRTY( overlay.blue, amountOfOverlay);
42
43 cleanup_R1();
44#else
45 // Corrected blend method, with no loss-of-precision rounding errors
46 existing.red = blend8(existing.red, overlay.red, amountOfOverlay);
47 existing.green = blend8(existing.green, overlay.green, amountOfOverlay);
48 existing.blue = blend8(existing.blue, overlay.blue, amountOfOverlay);
49#endif
50
51 return existing;
52}
u8 fract8
Fixed-Point Fractional Types.
Definition s16x16x4.h:161

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

+ Here is the caller graph for this function: