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

Function PiuApplication_animateColors

modules/piu/MC/piuView.c:1301–1330  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1299}
1300
1301void PiuApplication_animateColors(xsMachine* the)
1302{
1303#if kCommodettoBitmapCLUT16 == kPocoPixelFormat
1304 PiuApplication* self = PIU(Application, xsThis);
1305 PiuView* view = (*self)->view;
1306 PiuColorRecord color;
1307 PocoColor colors[16];
1308 xsIntegerValue i = 0;
1309 xsVars(3);
1310 while (i < 16) {
1311 xsVar(0) = xsGetAt(xsArg(0), xsInteger(i));
1312 PiuColorDictionary(the, &xsVar(0), &color);
1313 colors[i] = ((color.r >> 3) << 11) | ((color.g >> 2) << 5) | (color.b >> 3);
1314 i++;
1315 }
1316 xsVar(0) = xsReference((*view)->screen);
1317 xsVar(1) = xsNewHostObject(NULL);
1318 xsSetHostBuffer(xsVar(1), colors, 16 * 2);
1319 xsTry {
1320 xsVar(2) = xsCall1(xsVar(0), xsID_animateColors, xsVar(1));
1321 xsSetHostBuffer(xsVar(1), NULL, 0);
1322 if (xsTest(xsVar(2)))
1323 PiuViewInvalidate(view, NULL);
1324 }
1325 xsCatch {
1326 xsSetHostBuffer(xsVar(1), NULL, 0);
1327 xsThrow(xsException);
1328 }
1329#endif
1330}
1331
1332void PiuApplication_get_clut(xsMachine* the)
1333{

Callers

nothing calls this directly

Calls 2

PiuColorDictionaryFunction · 0.85
PiuViewInvalidateFunction · 0.70

Tested by

no test coverage detected