W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2012

Re: exposing CANVAS or something like it to Web Workers

From: Charles Pritchard <chuck@jumis.com>
Date: Mon, 14 May 2012 18:19:48 -0700
Message-ID: <4FB1AF34.4090805@jumis.com>
To: "Gregg Tavares (勤)" <gman@google.com>
CC: Boris Zbarsky <bzbarsky@mit.edu>, public-webapps@w3.org
On 5/14/2012 6:14 PM, Gregg Tavares (勤) wrote:
> On Mon, May 14, 2012 at 6:07 PM, Boris Zbarsky <bzbarsky@mit.edu 
> <mailto:bzbarsky@mit.edu>> wrote:
>     On 5/14/12 8:55 PM, Gregg Tavares (勤) wrote:
>            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.
>         Which methods are these?
>     Anything involving setting color (e.g. the strokeStyle setter, the
>     fillStyle setter), due to "currentColor".  Anything involving text
>     because font styles come from the element or document.
> Good to know.
> That doesn't sound like a showstopper though. If a 
> canvas/CanvasSurface is available in workers the simplest solution 
> would just be that "currentColor" defaults to something "black?" or 
> nothing "". Pick one.

Font is still a little tricky from loading fonts via CSS. Font is tricky 
anyway, though, so it wouldn't be that much of a step backward.

Would we assume that if a font is available from the parent context it's 
going to be available to the worker?

currentColor would just default to black, as we're not talking about a 
color inherited from the DOM.

>     Those are the ones that come to mind offhand, but I haven't looked
>     at the various recent additions to the 2d context closely.

The recent additions are more proposals than additions. They're 
proposals from Tab and Ian and not yet implemented.

They revolve around a Path object, which we've not yet discussed.
Otherwise, they include lightweight nodes and DOM fallback content, 
which isn't relevant to workers.

My thinking is the same as yours: fillStyle/strokeStyle and font are the 
ones that come to mind.
Pattern and Gradient are items that could conceivably be cloned and/or 
They can both be as efficient as sending Blob via postMessage.

I think Gregg was just settling on not-sending Canvas over postMessage 
but rather creating the instance inside of each Worker.
Received on Tuesday, 15 May 2012 01:20:12 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:13:34 UTC