MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / PiuColorsBlend

Function PiuColorsBlend

modules/piu/All/piuColor.c:76–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74};
75
76void PiuColorsBlend(PiuColor colors, double state, PiuColor color)
77{
78 double index = c_floor(state);
79 double plus = state - index;
80 PiuColor back = &colors[(uint32_t)index];
81 if (plus) {
82 // @@
83 PiuColor fore = &colors[(uint32_t)index + 1];
84 double minus = 1 - plus;
85 double r = ((double)back->r * minus) + ((double)fore->r * plus);
86 double g = ((double)back->g * minus) + ((double)fore->g * plus);
87 double b = ((double)back->b * minus) + ((double)fore->b * plus);
88 double a = ((double)back->a * minus) + ((double)fore->a * plus);
89 color->r = (uint8_t)c_round(r);
90 color->g = (uint8_t)c_round(g);
91 color->b = (uint8_t)c_round(b);
92 color->a = (uint8_t)c_round(a);
93 }
94 else {
95 *color = *back;
96 }
97}
98
99void PiuColorDictionary(xsMachine *the, xsSlot* slot, PiuColor color)
100{

Callers 8

PiuRoundRectDrawFunction · 0.85
PiuQRCodeDrawFunction · 0.85
PiuTextDrawFunction · 0.85
PiuSkinDrawFunction · 0.85
PiuStyleDrawFunction · 0.85
PiuShapeDrawFunction · 0.85
PiuQRCodeDrawFunction · 0.85
PiuRoundContentDrawFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected