19 {
20 if (amountOfOverlay == 0) {
21 return existing;
22 }
23
24 if (amountOfOverlay == 255) {
25 existing = overlay;
26 return existing;
27 }
28
29#if 0
30
31 fract8 amountOfKeep = 255 - amountOfOverlay;
32
39
41#else
42
43 existing.red =
blend8(existing.red, overlay.red, amountOfOverlay);
44 existing.green =
blend8(existing.green, overlay.green, amountOfOverlay);
45 existing.blue =
blend8(existing.blue, overlay.blue, amountOfOverlay);
46#endif
47
48 return existing;
49}
uint8_t fract8
ANSI: unsigned short _Fract.
LIB8STATIC uint8_t blend8(uint8_t a, uint8_t b, uint8_t amountOfB)
Blend a variable proportion (0-255) of one byte to another.
LIB8STATIC_ALWAYS_INLINE void cleanup_R1()
Clean up the r1 register after a series of *LEAVING_R1_DIRTY calls.
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.