Search code examples
javascripthtmlhtml5-canvasweb-worker

Drawing in workers


I am trying to draw in a web worker using html5 canvas. The worker doesn't have access to the DOM so I can't draw on a canvas from the web worker. This other stack overflow question suggests I can manipulate the ImageData from the worker.

Am I limiting to performing raw pixel manipulation on the ImageData item or can I perform things like drawBezzierCurve() on it? Or maybe there is a library to manipulate this type of data.


Solution

  • I figured out the best you can do is get the <canvas> raw imageData and pass the imageData back and forth between the web worker.