Created
September 5, 2019 15:46
-
-
Save gonzaloruizdevilla/edc6e93d63e66f40f970ea2ced4dbbf0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment