- From: Boris Zbarsky <bzbarsky@MIT.EDU>
- Date: Mon, 14 May 2012 20:12:34 -0400
- To: public-webapps@w3.org
On 5/14/12 8:03 PM, Gregg Tavares (勤) wrote:
> var canvasSurface = new CanvasSurface();
> var ctx = canvasSurface.getContext("2d");
> var pic = new Picture;
> pic.src = "http://someplace.com/someimage.jpg";
> pic.onload = function() {
> ctx.drawImage(pic, 0, );
> }
>
> Let's assume you can instantiate these things in either the page or a
> worker. Nether can be transfered.
>
> Would that work? What problems would that have?
Two things that come to mind immediately:
1) Various canvas 2d context methods depend on the styles of the canvas
to define how they actually behave. Clearly this would need some sort
of changes for Workers anyway; the question is what those changes would
need to be.
2) How (or maybe whether) this should work with pic.src =
"http://someplace.com/someimage.svg" is an interesting question.
3) This leaves open the question of how to get data from the worker
back to the main thread to paint there.
#1 is an issue with any proposal that puts a 2d context in a worker.
#2 is only an issue if we do the image loads in workers somehow; if we
wanted to just rasterize the SVG and pass the resulting data to the
worker there would be no problem, obviously.
For #3, being able to transfer a canvas context from the page to a
worker but leave it painting to the canvas may still be desirable...
-Boris
Received on Tuesday, 15 May 2012 00:13:05 UTC