Transport lab

Every route I could think of for getting DOM out of its canvas and into another context: another canvas, a worker, a cross-origin document. Each row is a test that runs in your browser. The small canvas shows what arrived at the far end, and a row passes only if the pixel read there matches the source element.

running…

Show the code what every route starts from

Every row below has its own Show the code link with the exact function that row ran. They all use these two helpers.

  1. source(): a drawable canvas with one element in it. s.el is the element, s.c the canvas, s.ctx its 2D context and s.snap() a fresh ElementImage from captureElementImage().
  2. arrive(): draw whatever came out the other end and check one pixel.
  3. The worker some routes send things to.
  4. The page on the other origin.

A · Moving the snapshot ElementImage and friends, DOM stays live

B · Getting around the one-canvas rule ways to keep it DOM

C · Moving pixels after drawElementImage

D · Streams and codecs continuous transport

E · GPU WebGL and WebGPU

Findings