Allow changing image loading implementation
RobLoach opened this issue · 1 comments
RobLoach commented
Add PNTR_LOAD_IMAGE
define to allow changing how images are loaded. Similar to PNTR_LOAD_FILE
konsumer commented
An example is like emscripten, where you could leverage the browser's image parser, using EM_JS
/EM_WASM
:
img=new Image()
for filedata:img.src=URL.createObjectURL(new Blob([bytes], { type: 'image/png' }))
- draw
img
toOffscreenCanvas
- copy canvas pixels into wasm memory
URL.revokeObjectURL(img.src)
,delete img
, anddelete offscreencanvas
to clear the mem.
it uses an async callback though, (on image load) so it could require other stuff (ASYNCIFY, etc.)