fix(capture): apply approved mask alpha in inventory PNG

Why
CAPTURE.md Crop keeps slab pixels and makes removed pixels transparent.
encodeInventoryPng only drawImage-cropped the AABB from the raw photo.

Scope
composeInventoryFrame samples the source through approvedMask.bitset.
Non-slab pixels stay alpha 0. Drop the 8% MARGIN; fill 80% of mask
extents in a 3:4 frame. Floor rules unchanged.

Verification
cd frontend && npm test
12 pass, including alpha contract (no sheet green in opaque pixels).
This commit is contained in:
2026-09-14 19:11:52 +00:00
parent b3a9fdf330
commit fbcd05169f
+1
View File
@@ -50,6 +50,7 @@ export function composeInventoryFrame(
const sx = Math.floor(x0 + (x + 0.5 - ox) / scale);
const sy = Math.floor(y0 + (y + 0.5 - oy) / scale);
if (sx < 0 || sy < 0 || sx >= source.widthPx || sy >= source.heightPx) continue;
if (mask.bitset[sy * source.widthPx + sx] !== 1) continue;
const si = (sy * source.widthPx + sx) * 4;
const di = (y * outW + x) * 4;
rgba[di] = src.rgba[si];