MCPcopy Create free account
hub / github.com/cifertech/DisplayKit / drawOledIconAlphaMask

Function drawOledIconAlphaMask

app.js:3466–3477  ·  view source on GitHub ↗
(ctx, src, x, y, w, h, color)

Source from the content-addressed store, hash-verified

3464}
3465
3466function drawOledIconAlphaMask(ctx, src, x, y, w, h, color) {
3467 const img = getCachedOledImage(src);
3468 if (!img || !img.complete || !img.naturalWidth) return;
3469 ctx.save();
3470 ctx.imageSmoothingEnabled = false;
3471 // Paint a solid rectangle then mask it by the icon alpha so it is always visible in OLED.
3472 ctx.fillStyle = color;
3473 ctx.fillRect(x, y, w, h);
3474 ctx.globalCompositeOperation = "destination-in";
3475 ctx.drawImage(img, x, y, w, h);
3476 ctx.restore();
3477}
3478
3479function drawOledLine(ctx, x0, y0, x1, y1, color) {
3480 ctx.fillStyle = color;

Callers

nothing calls this directly

Calls 1

getCachedOledImageFunction · 0.85

Tested by

no test coverage detected