On 5/14/2012 1:01 PM, Gregg Tavares (勤) wrote:
> I'd like to work on exposing something like CANVAS to web workers.
>
> Ideally how over it works I'd like to be able to
>
> *) get a 2d context in a web worker
> *) get a WebGL context in a web worker
> *) download images in a web worker and the images with both 2d
> contexts and WebGL contexts
>
> Any thoughts?
As far as implementation, I'd love to be able to pass webkit's
document.getCSSCanvasContext('2d') around.
It seems like a safe place to experiment.
I can get a lot done with CanvasPattern as a transferable, without
needing to add Image (or video) into the worker context.
Notes:
1. getCSSCanvasContext is non-standard. It works with CSS image
-webkit-canvas.
2. I heard that a more generic "-moz-element()" paint server is supposed
to replace -webkit-canvas in time.
3. Passing the CSS canvas context would let me render off-frame and
update a canvas visible on the document automatically.
Canvas -should- have toBlob and a typed array buffer for ImageData.
They are both useful for passing image data back to the main frame.
From my experience with WebGL, I think it should be considered with
added care and lower priority.
There are stability, speed and memory issues. WebGL in workers seems to
augment 2d, are there other big benefits?
-Charles