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

Function Piu_blendColors

modules/piu/All/piuColor.c:255–269  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

253}
254
255void Piu_blendColors(xsMachine* the)
256{
257 PiuColorRecord c0;
258 PiuColorRecord c1;
259 PiuColorRecord c2;
260 xsNumberValue plus = xsToNumber(xsArg(0));
261 xsNumberValue minus = 1 - plus;
262 PiuColorDictionary(the, &xsArg(1), &c1);
263 PiuColorDictionary(the, &xsArg(2), &c2);
264 c0.r = (uint8_t)c_round(((double)c1.r * minus) + ((double)c2.r * plus));
265 c0.g = (uint8_t)c_round(((double)c1.g * minus) + ((double)c2.g * plus));
266 c0.b = (uint8_t)c_round(((double)c1.b * minus) + ((double)c2.b * plus));
267 c0.a = (uint8_t)c_round(((double)c1.a * minus) + ((double)c2.a * plus));
268 xsResult = xsUnsigned(((uint32_t)c0.r << 24) | ((uint32_t)c0.g << 16) | ((uint32_t)c0.b << 8) | ((uint32_t)c0.a));
269}
270
271void Piu_hsl(xsMachine* the)
272{

Callers

nothing calls this directly

Calls 1

PiuColorDictionaryFunction · 0.85

Tested by

no test coverage detected