MCPcopy Create free account
hub / github.com/BruceDevices/firmware / drawImageCached

Function drawImageCached

embedded_resources/web_interface/index.js:597–608  ·  view source on GitHub ↗
(img_url, input)

Source from the content-addressed store, hash-verified

595 };
596
597 const drawImageCached = async (img_url, input) => {
598 if (IS_DEV) img_url = "/bruce" + img_url;
599 let img = await loadImage(img_url);
600 let drawX = input.x;
601 let drawY = input.y;
602
603 if (input.center === 1) {
604 drawX += (canvas.width - img.width) / 2;
605 drawY += (canvas.height - img.height) / 2;
606 }
607 ctx.drawImage(img, drawX, drawY);
608 };
609
610 const color565toCSS = (color565) => {
611 const r = (((color565 >> 11) & 0x1f) * 255) / 31;

Callers 1

renderTFTFunction · 0.85

Calls 1

loadImageFunction · 0.85

Tested by

no test coverage detected