[whatwg] Enabling LCD Text and antialiasing in canvas

Gregg Tavares gman at google.com
Wed Mar 13 11:48:28 PDT 2013

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

   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?

More information about the whatwg mailing list