W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2013

Re: [whatwg] Enabling LCD Text and antialiasing in canvas

From: Stephen White <senorblanco@chromium.org>
Date: Thu, 14 Mar 2013 10:34:12 -0400
Message-ID: <CAPeKFTg0qUZMo=XikHUzMYwH4XYEQi-M8BuGq1zkJhOFS2SX2w@mail.gmail.com>
To: Gregg Tavares <gman@google.com>
Cc: WHAT Working Group <whatwg@whatwg.org>, Ian Hickson <ian@hixie.ch>, Rik Cabanier <cabanier@gmail.com>, Robert O'Callahan <robert@ocallahan.org>
On Wed, Mar 13, 2013 at 2:48 PM, Gregg Tavares <gman@google.com> wrote:

> Sorry for only mentioning this so late but is there any chance to steer
> this to be more inline with WebGL?
> WebGL already has the option to have an opaque canvas using context
> creation parameters. In WebGL it's
>    gl = canvas.getContext("webgl", {alpha: false});
> If we go forward with an "opaque" attribute now you have 2 conflicting
> settings.
>    canvas.opaque = true;
>    gl = canvas.getContext("webgl", {alpha: true});
> Who wins that conflict? Yea, I know we could come up with rules. (&& the 2
> settings, etc...)
> But, there are other context creation attributes we'd like to see on a 2d
> canvas. One that comes to mind is 'preserveDrawingBuffer'.
> preserveDrawingBuffer: false in WebGL means that the canvas is double
> buffered. This is a performance win since most browsers using GPU
> compositing need to copy the contents of the canvas when compositing.
> Setting preseverDrawingBuffer: false (which is the default in WebGL) means
> the browser can double buffer and avoid the copy. We'd like to see that
> same attribute for 2D canvas/contexts to get the same perf benefit for
> canvas games, etc.

> So, given we want more creation attributes and given WebGL already has a
> way to declare opaqueness why not follow the existing method and add
> context creation parameters to 2d canvas to solve this issue rather than
> make a new and conflicting 'opaque' attribute?

I have no major objections to this approach, so long as it doesn't make
this change contingent on a WebGL spec change.  In particular, it's
tempting to unify the IDL between Canvas & WebGL (although it may not be
necessary -- I'm far from an IDL expert.)  Here, let me show you my
ignorance:  can we create a

interface Canvas2DContextAttributes {
  attribute boolean alpha;

which has no relation to WebGLContextAttributes?

Then we get at least the "duck typing" such that

ctx = canvas.getContext('2d', {alpha: false });


ctx = canvas.getContext('webgl', {alpha: false });

both work, although one is coerced into a WebGLContextAttributes and the
other to a Canvas2DContextAttributes.

Does that make sense?

Received on Thursday, 14 March 2013 14:34:49 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:56 UTC