Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //retrieve image pixels (4 bytes per pixel: RBGA)
- const data = imageData.data;
- //copy to bytes to shared memory
- mem.set(data);
- //invoque 'fn' Wasm filter. We need to inform of the image byte size
- const byteSize = data.length;
- instance.exports[fn](byteSize, ...args);
- //copy the response from the shared memory into the canvas imageData
- data.set(mem.slice(byteSize, 2*byteSize))
- //update canvas
- ctx.putImageData(imageData, 0, 0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement