Canvas Pixel Transformation: Beauty comes slowly
summary
A Mapbox canvas is read with Mapbox webgl readPixels and converted into a 2D ImageData array, a flood‑fill area detector paints road‑delimited mosaics, and the prototype runs in a React + TypeScript app. Pixel loop costs dominate: a fullHD frame (~5 million pixels) takes up to 5 seconds (uploader estimated >2s earlier). Moving the flood fill into web workers with worker‑loader prevents UI jank and aborts stale jobs, but overall rendering remains slow and needs a WebGL or WASM reimplementation.
AI-written summary · about
chapters (10)
- 0:00Canvas pixel manipulation
- 2:40React canvas demo setup
- 4:50Painting rectangle and pixels
- 10:08Canvas size vs Mapbox
- 13:06Copying Mapbox pixels
- 16:42Area detection algorithm
- 23:16UI blocking with workers
- 28:46Integrating web workers
- 32:19Worker performance
- 33:29Conclusion
related talks
58mRendering performance from the ground up
32mPainting Pixels with WebGL with React Hooks
18mEscaping flatland: a romance of data science in the browser
21mDrawing Maps with OpenGL
39mLife of a pixel: A visual explanation of rendering performance
15mMaking maps work on mobile
28mHTML Canvas 어디까지 써봤니
30mMaps Platform: A Deep Dive on Building for Performance and Scale
