1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
x4 x4 x4 x4   x41 x41 x41 x41 x41 x41 x84 x2172 x2172 x2172   x2172 x84 x84 x84 x41 x41 |
export function scanlines( input: Uint8Array, pSize: number, images: [number, number][], ): Uint8Array[][] { const output: Uint8Array[][] = new Array(images.length) .fill(0) .map(() => []); let i = 0; let offset = 0; for (const [width, height] of images) { for (let h = 0; h < height; ++h) { output[i][h] = input.subarray( offset + h * width * pSize, offset + (h + 1) * width * pSize, ); } offset += width * height * pSize; ++i; } return output; } |