Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. //retrieve image pixels (4 bytes per pixel: RBGA)
  2. const data = imageData.data;
  3. //copy to bytes to shared memory
  4. mem.set(data);
  5.  
  6. //invoque 'fn' Wasm filter. We need to inform of the image byte size
  7. const byteSize = data.length;
  8. instance.exports[fn](byteSize, ...args);
  9.  
  10. //copy the response from the shared memory into the canvas imageData
  11. data.set(mem.slice(byteSize, 2*byteSize))
  12. //update canvas
  13. ctx.putImageData(imageData, 0, 0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement