import { keySheet } from './src/lib/core/mask.js'; const W = 20, H = 10; const data = new Uint8ClampedArray(W * H * 4); for (let y = 0; y < H; y++) for (let x = 0; x < W; x++) { const i = (y * W + x) * 4; const inSlab = x >= 5 && x < 15 && y >= 2 && y < 8; if (inSlab) { data[i]=139; data[i+1]=90; data[i+2]=43; } else { data[i]=34; data[i+1]=139; data[i+2]=34; } data[i+3] = 255; } const m = keySheet(data, { sheet: 'green', sensitivity: 50 }); console.log('row 5:', Array.from(m.slice(5*W, 6*W))); console.log('row 5 length:', m.slice(5*W, 6*W).length); const arr = m.slice(5*W, 6*W); let all1 = true; for (let i = 0; i < W; i++) if (arr[i] !== 1) { all1 = false; console.log('x=', i, 'val=', arr[i]); } console.log('all 1s?', all1); // Check a specific pixel const px5 = m[5*W+10]; console.log('px at (10,5):', px5); const px0 = m[0]; console.log('px at (0,0):', px0);