RobLoach/pntr

Allow changing image loading implementation

RobLoach opened this issue · 1 comments

Add PNTR_LOAD_IMAGE define to allow changing how images are loaded. Similar to PNTR_LOAD_FILE

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 to OffscreenCanvas
  • copy canvas pixels into wasm memory
  • URL.revokeObjectURL(img.src), delete img, and delete offscreencanvas to clear the mem.

it uses an async callback though, (on image load) so it could require other stuff (ASYNCIFY, etc.)