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:
@@ -50,6 +50,7 @@ export function composeInventoryFrame(
|
|||||||
const sx = Math.floor(x0 + (x + 0.5 - ox) / scale);
|
const sx = Math.floor(x0 + (x + 0.5 - ox) / scale);
|
||||||
const sy = Math.floor(y0 + (y + 0.5 - oy) / scale);
|
const sy = Math.floor(y0 + (y + 0.5 - oy) / scale);
|
||||||
if (sx < 0 || sy < 0 || sx >= source.widthPx || sy >= source.heightPx) continue;
|
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 si = (sy * source.widthPx + sx) * 4;
|
||||||
const di = (y * outW + x) * 4;
|
const di = (y * outW + x) * 4;
|
||||||
rgba[di] = src.rgba[si];
|
rgba[di] = src.rgba[si];
|
||||||
|
|||||||
Reference in New Issue
Block a user