Skip to content

aminya/webassembly-canvas

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Webassembly Canvas

How it works?

A canvas context is made on the JavaScript side. Then, an ImageData is created, which is a live view to the underlying Uint8ClampedArray. Uint8ClampedArray is a live view to the underlying ArrayBuffer, which is exported from WebAssembly as a memory instance. For each frame, the data is updated inside Webassembly, and then it calls putImageData to update the pixels inside canvas.

canvas-demo

Install

You need to have npm. Then:

npm install

Build

npm run build

There are different build scripts.

npm run build.clang       # requires clang      https://releases.llvm.org/download.html
npm run build.emsdk       # requires emsdk      https://emscripten.org/docs/getting_started/downloads.html
npm run build.d           # requires ldc        https://github.com/ldc-developers/ldc/releases
npm run build.decompile   # requires wabt       https://github.com/WebAssembly/wabt/releases
npm run build.wasm2wat    # requires wabt       https://github.com/WebAssembly/wabt/releases
npm run build.wasm2js     # requires binaryan   https://github.com/WebAssembly/binaryen/releases
npm run build.asmjs       # requires emsdk      https://emscripten.org/docs/getting_started/downloads.html

To clean

npm run clean

Run

After you built:

npm run serve

About

Draw canvas using WASM

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • JavaScript 61.1%
  • C++ 15.4%
  • D 15.1%
  • HTML 8.4%