[whatwg] Canvas tag - single or multiple contexts?

Gregg Tavares gman at google.com
Mon Dec 21 12:04:49 PST 2009


On Mon, Dec 21, 2009 at 11:56 AM, Anne van Kesteren <annevk at opera.com>wrote:

> On Mon, 21 Dec 2009 20:50:33 +0100, Gregg Tavares <gman at google.com> wrote:
>
>> What is the intent of the getContext function on the <canvas> tag?
>>
>> Should it be possible to get multiple simultaneous different contexts as
>> in?
>>
>> var ctx2d = canvas.getContext("2d");
>> var ctxText = canvas.getContext("fancy-text-api");
>> var ctxFilter = canvas.getContext("image-filter-api");
>>
>> ctx2d.drawImage(someImage, 0, 0);
>> ctxText.drawText(0, 0, "hello world");
>> ctxFilter.radialBlur(0.1);
>>
>> ?
>>
>> OR
>>
>> is canvas only allowed 1 context at a time?
>>
>
> In theory multiple contexts should be possible. E.g. we supported 2d,
> opera-2dgame, and opera-3d for a while. However it seems that for certain
> contexts, in particular webgl, using it together with other contexts is not
> possible (for now anyway).
>
>
Is disallowing other contexts when certain contexts, eg "webgl", okay or is
that really an incompatible extension of the canvas tag?

Can portable code be written if some browsers let me get both a "2d" context
and a "3d" context and others don't?


>
> --
> Anne van Kesteren
> http://annevankesteren.nl/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20091221/506d7577/attachment.htm>


More information about the whatwg mailing list