<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.whatwg.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=StephenWhite</id>
	<title>WHATWG Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.whatwg.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=StephenWhite"/>
	<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/wiki/Special:Contributions/StephenWhite"/>
	<updated>2026-05-26T08:33:00Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=CanvasOpaque&amp;diff=9107</id>
		<title>CanvasOpaque</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=CanvasOpaque&amp;diff=9107"/>
		<updated>2013-04-22T17:00:08Z</updated>

		<summary type="html">&lt;p&gt;StephenWhite: /* Rationale: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;This proposal is to allow the specification of an opaque backing store for 2D Canvas, to optimize blending and culling.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Use case: A 2D UI is written using canvas which is attempting to achieve top performance.  It clears its backing store to opaque, and only uses non-alpha-modifying canvas commands, but since the user agent cannot determine this empirically from an arbitrary set of canvas commands, it cannot optimize the blending and culling of obscured elements when compositing the canvas into the page.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
Many sites already draw only opaque canvases, but have no way to convey this to the user agent.  There is no known workaround for performance.&lt;br /&gt;
&lt;br /&gt;
Compositing a &amp;lt;canvas&amp;gt; element into the page can be expensive, due to blending operations, and lack of opportunity for culling.  Since arbitrary graphics operations can affect the opacity of the canvas, it is difficult to determine programmatically whether the canvas is opaque.  Allowing the developer to explicitly mark a canvas as opaque allows the user agent to optimize blending at page composite time, as well to cull fully-obscured elements behind the canvas.&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
# Allow the specification of an opaque backing store for canvas.&lt;br /&gt;
# Modify all canvas operations to respect the opaque backing store (i.e., to leave all per-pixel alpha at 1.0).&lt;br /&gt;
# Allow the user agent to easily optimize compositing and culling of the canvas.&lt;br /&gt;
&lt;br /&gt;
== Non Goals ==&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
One proposed solution was the &amp;lt;code&amp;gt;opaque&amp;lt;/code&amp;gt; attribute on the &amp;lt;code&amp;gt;canvas&amp;lt;/code&amp;gt; element. This was implemented by Mozilla and has been shipping in Firefox as the &amp;lt;code&amp;gt;moz-opaque&amp;lt;/code&amp;gt; attribute. Semantically, this is exactly what we want. However, it does not match WebGL syntax.&lt;br /&gt;
&lt;br /&gt;
=== Suggested Solution ===&lt;br /&gt;
&lt;br /&gt;
Allow an optional parameter to the Canvas element&#039;s &amp;lt;code&amp;gt;getContext&amp;lt;/code&amp;gt; method, which specifies the context creation parameter object.  The object contains the boolean &amp;lt;code&amp;gt;alpha&amp;lt;/code&amp;gt; property:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    var ctx = canvas.getContext(&#039;2d&#039;, { alpha: false });&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When alpha is false, the per-pixel alpha values in the canvas backing store must be 1.0 at all times. All canvas operations are modified to preserve this invariant. If the attribute is not specified, the default value of &amp;quot;true&amp;quot; must be used instead.&lt;br /&gt;
&lt;br /&gt;
When alpha is false, the backing store must be initialized to opaque black (rgba(0, 0, 0, 1.0)), instead of transparent black (rgba(0, 0, 0, 0.0)). In addition, clearRect() clears to opaque black instead of transparent black.&lt;br /&gt;
&lt;br /&gt;
The behaviour of putImageData() and putImageDataHD() is to premultiply the RGB components by the alpha component as usual, but write 1.0 into destination alpha.  In other words, if (r, g, b, a) are the component values in a given pixel passed to putImageData[HD](), then r&#039; = ar, g&#039; = ag, b&#039; = ab are the colour components of the resulting canvas pixel, and (r&#039;, g&#039;, b&#039;, 1.0) is written to the canvas backing store.&lt;br /&gt;
&lt;br /&gt;
When a canvas has alpha: false, all globalCompositeOperation modes behave as normal and the resulting RGB components are written to the canvas backing store, but the per-pixel alpha component is left unchanged at 1.0.&lt;br /&gt;
&lt;br /&gt;
== Suggested IDL ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dictionary Canvas2DContextAttributes {&lt;br /&gt;
    boolean alpha;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
interface Canvas2DRenderingContext {&lt;br /&gt;
    ...&lt;br /&gt;
    Canvas2DContextAttributes? getContextAttributes();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Rationale: ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why not add a new element attribute instead?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Implementing the same syntax as WebGL brings consistency to the web platform, obeys the principle of least surprise for developers.  It also may allow more code sharing in JavaScript, since with duck typing, the same object can be used for both canvas and WebGL.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Can you call getContext more than once on the same canvas, with different values for { alpha }?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; No.  Once it has been called once, the type of the backing store is set.  On subsequent calls to getContext(), the context attributes parameter is ignored.&lt;br /&gt;
&lt;br /&gt;
== Issues: ==&lt;br /&gt;
&lt;br /&gt;
=== Implementing non-alpha-modifying compositing modes may be difficult in some 2D graphics APIs ===&lt;br /&gt;
&lt;br /&gt;
The CoreGraphics API provides a mechanism to specify an opaque backing store, via kCGImageAlphaNoneSkipLast.  However, it seems that IOSurfaces do not.&lt;br /&gt;
&lt;br /&gt;
How the different APIs which do support such a mechanism behave with respect to different compositing modes is also TBD.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>StephenWhite</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=CanvasOpaque&amp;diff=9106</id>
		<title>CanvasOpaque</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=CanvasOpaque&amp;diff=9106"/>
		<updated>2013-04-22T16:56:00Z</updated>

		<summary type="html">&lt;p&gt;StephenWhite: /* Suggested IDL */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;This proposal is to allow the specification of an opaque backing store for 2D Canvas, to optimize blending and culling.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Use case: A 2D UI is written using canvas which is attempting to achieve top performance.  It clears its backing store to opaque, and only uses non-alpha-modifying canvas commands, but since the user agent cannot determine this empirically from an arbitrary set of canvas commands, it cannot optimize the blending and culling of obscured elements when compositing the canvas into the page.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
Many sites already draw only opaque canvases, but have no way to convey this to the user agent.  There is no known workaround for performance.&lt;br /&gt;
&lt;br /&gt;
Compositing a &amp;lt;canvas&amp;gt; element into the page can be expensive, due to blending operations, and lack of opportunity for culling.  Since arbitrary graphics operations can affect the opacity of the canvas, it is difficult to determine programmatically whether the canvas is opaque.  Allowing the developer to explicitly mark a canvas as opaque allows the user agent to optimize blending at page composite time, as well to cull fully-obscured elements behind the canvas.&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
# Allow the specification of an opaque backing store for canvas.&lt;br /&gt;
# Modify all canvas operations to respect the opaque backing store (i.e., to leave all per-pixel alpha at 1.0).&lt;br /&gt;
# Allow the user agent to easily optimize compositing and culling of the canvas.&lt;br /&gt;
&lt;br /&gt;
== Non Goals ==&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
One proposed solution was the &amp;lt;code&amp;gt;opaque&amp;lt;/code&amp;gt; attribute on the &amp;lt;code&amp;gt;canvas&amp;lt;/code&amp;gt; element. This was implemented by Mozilla and has been shipping in Firefox as the &amp;lt;code&amp;gt;moz-opaque&amp;lt;/code&amp;gt; attribute. Semantically, this is exactly what we want. However, it does not match WebGL syntax.&lt;br /&gt;
&lt;br /&gt;
=== Suggested Solution ===&lt;br /&gt;
&lt;br /&gt;
Allow an optional parameter to the Canvas element&#039;s &amp;lt;code&amp;gt;getContext&amp;lt;/code&amp;gt; method, which specifies the context creation parameter object.  The object contains the boolean &amp;lt;code&amp;gt;alpha&amp;lt;/code&amp;gt; property:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    var ctx = canvas.getContext(&#039;2d&#039;, { alpha: false });&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When alpha is false, the per-pixel alpha values in the canvas backing store must be 1.0 at all times. All canvas operations are modified to preserve this invariant. If the attribute is not specified, the default value of &amp;quot;true&amp;quot; must be used instead.&lt;br /&gt;
&lt;br /&gt;
When alpha is false, the backing store must be initialized to opaque black (rgba(0, 0, 0, 1.0)), instead of transparent black (rgba(0, 0, 0, 0.0)). In addition, clearRect() clears to opaque black instead of transparent black.&lt;br /&gt;
&lt;br /&gt;
The behaviour of putImageData() and putImageDataHD() is to premultiply the RGB components by the alpha component as usual, but write 1.0 into destination alpha.  In other words, if (r, g, b, a) are the component values in a given pixel passed to putImageData[HD](), then r&#039; = ar, g&#039; = ag, b&#039; = ab are the colour components of the resulting canvas pixel, and (r&#039;, g&#039;, b&#039;, 1.0) is written to the canvas backing store.&lt;br /&gt;
&lt;br /&gt;
When a canvas has alpha: false, all globalCompositeOperation modes behave as normal and the resulting RGB components are written to the canvas backing store, but the per-pixel alpha component is left unchanged at 1.0.&lt;br /&gt;
&lt;br /&gt;
== Suggested IDL ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dictionary Canvas2DContextAttributes {&lt;br /&gt;
    boolean alpha;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
interface Canvas2DRenderingContext {&lt;br /&gt;
    ...&lt;br /&gt;
    Canvas2DContextAttributes? getContextAttributes();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Rationale: ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why not add a new element attribute instead?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Implementing the same syntax as WebGL brings consistency to the web platform, obeys the principle of least surprise for developers.  It also may allow more code sharing in JavaScript, since with duck typing, the same object can be used for both canvas and WebGL.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Can you call getContext more than once on the same canvas, with different values for { alpha }?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; No.  Once it has been called once, the type of the backing store is set.  Calling it again with a different argument raises an exception.&lt;br /&gt;
&lt;br /&gt;
== Issues: ==&lt;br /&gt;
&lt;br /&gt;
=== Implementing non-alpha-modifying compositing modes may be difficult in some 2D graphics APIs ===&lt;br /&gt;
&lt;br /&gt;
The CoreGraphics API provides a mechanism to specify an opaque backing store, via kCGImageAlphaNoneSkipLast.  However, it seems that IOSurfaces do not.&lt;br /&gt;
&lt;br /&gt;
How the different APIs which do support such a mechanism behave with respect to different compositing modes is also TBD.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>StephenWhite</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=CanvasOpaque&amp;diff=9105</id>
		<title>CanvasOpaque</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=CanvasOpaque&amp;diff=9105"/>
		<updated>2013-04-19T17:30:51Z</updated>

		<summary type="html">&lt;p&gt;StephenWhite: /* Suggested IDL */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;This proposal is to allow the specification of an opaque backing store for 2D Canvas, to optimize blending and culling.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Use case: A 2D UI is written using canvas which is attempting to achieve top performance.  It clears its backing store to opaque, and only uses non-alpha-modifying canvas commands, but since the user agent cannot determine this empirically from an arbitrary set of canvas commands, it cannot optimize the blending and culling of obscured elements when compositing the canvas into the page.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
Many sites already draw only opaque canvases, but have no way to convey this to the user agent.  There is no known workaround for performance.&lt;br /&gt;
&lt;br /&gt;
Compositing a &amp;lt;canvas&amp;gt; element into the page can be expensive, due to blending operations, and lack of opportunity for culling.  Since arbitrary graphics operations can affect the opacity of the canvas, it is difficult to determine programmatically whether the canvas is opaque.  Allowing the developer to explicitly mark a canvas as opaque allows the user agent to optimize blending at page composite time, as well to cull fully-obscured elements behind the canvas.&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
# Allow the specification of an opaque backing store for canvas.&lt;br /&gt;
# Modify all canvas operations to respect the opaque backing store (i.e., to leave all per-pixel alpha at 1.0).&lt;br /&gt;
# Allow the user agent to easily optimize compositing and culling of the canvas.&lt;br /&gt;
&lt;br /&gt;
== Non Goals ==&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
One proposed solution was the &amp;lt;code&amp;gt;opaque&amp;lt;/code&amp;gt; attribute on the &amp;lt;code&amp;gt;canvas&amp;lt;/code&amp;gt; element. This was implemented by Mozilla and has been shipping in Firefox as the &amp;lt;code&amp;gt;moz-opaque&amp;lt;/code&amp;gt; attribute. Semantically, this is exactly what we want. However, it does not match WebGL syntax.&lt;br /&gt;
&lt;br /&gt;
=== Suggested Solution ===&lt;br /&gt;
&lt;br /&gt;
Allow an optional parameter to the Canvas element&#039;s &amp;lt;code&amp;gt;getContext&amp;lt;/code&amp;gt; method, which specifies the context creation parameter object.  The object contains the boolean &amp;lt;code&amp;gt;alpha&amp;lt;/code&amp;gt; property:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    var ctx = canvas.getContext(&#039;2d&#039;, { alpha: false });&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When alpha is false, the per-pixel alpha values in the canvas backing store must be 1.0 at all times. All canvas operations are modified to preserve this invariant. If the attribute is not specified, the default value of &amp;quot;true&amp;quot; must be used instead.&lt;br /&gt;
&lt;br /&gt;
When alpha is false, the backing store must be initialized to opaque black (rgba(0, 0, 0, 1.0)), instead of transparent black (rgba(0, 0, 0, 0.0)). In addition, clearRect() clears to opaque black instead of transparent black.&lt;br /&gt;
&lt;br /&gt;
The behaviour of putImageData() and putImageDataHD() is to premultiply the RGB components by the alpha component as usual, but write 1.0 into destination alpha.  In other words, if (r, g, b, a) are the component values in a given pixel passed to putImageData[HD](), then r&#039; = ar, g&#039; = ag, b&#039; = ab are the colour components of the resulting canvas pixel, and (r&#039;, g&#039;, b&#039;, 1.0) is written to the canvas backing store.&lt;br /&gt;
&lt;br /&gt;
When a canvas has alpha: false, all globalCompositeOperation modes behave as normal and the resulting RGB components are written to the canvas backing store, but the per-pixel alpha component is left unchanged at 1.0.&lt;br /&gt;
&lt;br /&gt;
== Suggested IDL ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
interface Canvas2DContextAttributes {&lt;br /&gt;
    attribute boolean alpha;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
interface Canvas2DRenderingContext {&lt;br /&gt;
    ...&lt;br /&gt;
    Canvas2DContextAttributes? getContextAttributes();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Rationale: ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why not add a new element attribute instead?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Implementing the same syntax as WebGL brings consistency to the web platform, obeys the principle of least surprise for developers.  It also may allow more code sharing in JavaScript, since with duck typing, the same object can be used for both canvas and WebGL.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Can you call getContext more than once on the same canvas, with different values for { alpha }?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; No.  Once it has been called once, the type of the backing store is set.  Calling it again with a different argument raises an exception.&lt;br /&gt;
&lt;br /&gt;
== Issues: ==&lt;br /&gt;
&lt;br /&gt;
=== Implementing non-alpha-modifying compositing modes may be difficult in some 2D graphics APIs ===&lt;br /&gt;
&lt;br /&gt;
The CoreGraphics API provides a mechanism to specify an opaque backing store, via kCGImageAlphaNoneSkipLast.  However, it seems that IOSurfaces do not.&lt;br /&gt;
&lt;br /&gt;
How the different APIs which do support such a mechanism behave with respect to different compositing modes is also TBD.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>StephenWhite</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=CanvasOpaque&amp;diff=9104</id>
		<title>CanvasOpaque</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=CanvasOpaque&amp;diff=9104"/>
		<updated>2013-04-19T14:43:38Z</updated>

		<summary type="html">&lt;p&gt;StephenWhite: /* Suggested Solution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;This proposal is to allow the specification of an opaque backing store for 2D Canvas, to optimize blending and culling.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Use case: A 2D UI is written using canvas which is attempting to achieve top performance.  It clears its backing store to opaque, and only uses non-alpha-modifying canvas commands, but since the user agent cannot determine this empirically from an arbitrary set of canvas commands, it cannot optimize the blending and culling of obscured elements when compositing the canvas into the page.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
Many sites already draw only opaque canvases, but have no way to convey this to the user agent.  There is no known workaround for performance.&lt;br /&gt;
&lt;br /&gt;
Compositing a &amp;lt;canvas&amp;gt; element into the page can be expensive, due to blending operations, and lack of opportunity for culling.  Since arbitrary graphics operations can affect the opacity of the canvas, it is difficult to determine programmatically whether the canvas is opaque.  Allowing the developer to explicitly mark a canvas as opaque allows the user agent to optimize blending at page composite time, as well to cull fully-obscured elements behind the canvas.&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
# Allow the specification of an opaque backing store for canvas.&lt;br /&gt;
# Modify all canvas operations to respect the opaque backing store (i.e., to leave all per-pixel alpha at 1.0).&lt;br /&gt;
# Allow the user agent to easily optimize compositing and culling of the canvas.&lt;br /&gt;
&lt;br /&gt;
== Non Goals ==&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
One proposed solution was the &amp;lt;code&amp;gt;opaque&amp;lt;/code&amp;gt; attribute on the &amp;lt;code&amp;gt;canvas&amp;lt;/code&amp;gt; element. This was implemented by Mozilla and has been shipping in Firefox as the &amp;lt;code&amp;gt;moz-opaque&amp;lt;/code&amp;gt; attribute. Semantically, this is exactly what we want. However, it does not match WebGL syntax.&lt;br /&gt;
&lt;br /&gt;
=== Suggested Solution ===&lt;br /&gt;
&lt;br /&gt;
Allow an optional parameter to the Canvas element&#039;s &amp;lt;code&amp;gt;getContext&amp;lt;/code&amp;gt; method, which specifies the context creation parameter object.  The object contains the boolean &amp;lt;code&amp;gt;alpha&amp;lt;/code&amp;gt; property:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    var ctx = canvas.getContext(&#039;2d&#039;, { alpha: false });&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When alpha is false, the per-pixel alpha values in the canvas backing store must be 1.0 at all times. All canvas operations are modified to preserve this invariant. If the attribute is not specified, the default value of &amp;quot;true&amp;quot; must be used instead.&lt;br /&gt;
&lt;br /&gt;
When alpha is false, the backing store must be initialized to opaque black (rgba(0, 0, 0, 1.0)), instead of transparent black (rgba(0, 0, 0, 0.0)). In addition, clearRect() clears to opaque black instead of transparent black.&lt;br /&gt;
&lt;br /&gt;
The behaviour of putImageData() and putImageDataHD() is to premultiply the RGB components by the alpha component as usual, but write 1.0 into destination alpha.  In other words, if (r, g, b, a) are the component values in a given pixel passed to putImageData[HD](), then r&#039; = ar, g&#039; = ag, b&#039; = ab are the colour components of the resulting canvas pixel, and (r&#039;, g&#039;, b&#039;, 1.0) is written to the canvas backing store.&lt;br /&gt;
&lt;br /&gt;
When a canvas has alpha: false, all globalCompositeOperation modes behave as normal and the resulting RGB components are written to the canvas backing store, but the per-pixel alpha component is left unchanged at 1.0.&lt;br /&gt;
&lt;br /&gt;
== Suggested IDL ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
interface Canvas2DContextAttributes {&lt;br /&gt;
    attribute boolean alpha;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
interface Canvas2DRenderingContext {&lt;br /&gt;
    ...&lt;br /&gt;
    Canvas2DContextAttributes getContextAttributes();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Rationale: ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why not add a new element attribute instead?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Implementing the same syntax as WebGL brings consistency to the web platform, obeys the principle of least surprise for developers.  It also may allow more code sharing in JavaScript, since with duck typing, the same object can be used for both canvas and WebGL.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Can you call getContext more than once on the same canvas, with different values for { alpha }?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; No.  Once it has been called once, the type of the backing store is set.  Calling it again with a different argument raises an exception.&lt;br /&gt;
&lt;br /&gt;
== Issues: ==&lt;br /&gt;
&lt;br /&gt;
=== Implementing non-alpha-modifying compositing modes may be difficult in some 2D graphics APIs ===&lt;br /&gt;
&lt;br /&gt;
The CoreGraphics API provides a mechanism to specify an opaque backing store, via kCGImageAlphaNoneSkipLast.  However, it seems that IOSurfaces do not.&lt;br /&gt;
&lt;br /&gt;
How the different APIs which do support such a mechanism behave with respect to different compositing modes is also TBD.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>StephenWhite</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=CanvasOpaque&amp;diff=9099</id>
		<title>CanvasOpaque</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=CanvasOpaque&amp;diff=9099"/>
		<updated>2013-04-17T22:43:46Z</updated>

		<summary type="html">&lt;p&gt;StephenWhite: /* Rationale: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;This proposal is to allow the specification of an opaque backing store for 2D Canvas, to optimize blending and culling.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Use case: A 2D UI is written using canvas which is attempting to achieve top performance.  It clears its backing store to opaque, and only uses non-alpha-modifying canvas commands, but since the user agent cannot determine this empirically from an arbitrary set of canvas commands, it cannot optimize the blending and culling of obscured elements when compositing the canvas into the page.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
Many sites already draw only opaque canvases, but have no way to convey this to the user agent.  There is no known workaround for performance.&lt;br /&gt;
&lt;br /&gt;
Compositing a &amp;lt;canvas&amp;gt; element into the page can be expensive, due to blending operations, and lack of opportunity for culling.  Since arbitrary graphics operations can affect the opacity of the canvas, it is difficult to determine programmatically whether the canvas is opaque.  Allowing the developer to explicitly mark a canvas as opaque allows the user agent to optimize blending at page composite time, as well to cull fully-obscured elements behind the canvas.&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
# Allow the specification of an opaque backing store for canvas.&lt;br /&gt;
# Modify all canvas operations to respect the opaque backing store (i.e., to leave all per-pixel alpha at 1.0).&lt;br /&gt;
# Allow the user agent to easily optimize compositing and culling of the canvas.&lt;br /&gt;
&lt;br /&gt;
== Non Goals ==&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
One proposed solution was the &amp;lt;code&amp;gt;opaque&amp;lt;/code&amp;gt; attribute on the &amp;lt;code&amp;gt;canvas&amp;lt;/code&amp;gt; element. This was implemented by Mozilla and has been shipping in Firefox as the &amp;lt;code&amp;gt;moz-opaque&amp;lt;/code&amp;gt; attribute. Semantically, this is exactly what we want. However, it does not match WebGL syntax.&lt;br /&gt;
&lt;br /&gt;
=== Suggested Solution ===&lt;br /&gt;
&lt;br /&gt;
Allow an optional parameter to the Canvas element&#039;s &amp;lt;code&amp;gt;getContext&amp;lt;/code&amp;gt; method, which specifies the context creation parameter object.  The object contains the boolean &amp;lt;code&amp;gt;alpha&amp;lt;/code&amp;gt; property:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    var ctx = canvas.getContext(&#039;2d&#039;, { alpha: false });&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Suggested IDL ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
interface Canvas2DContextAttributes {&lt;br /&gt;
    attribute boolean alpha;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
interface Canvas2DRenderingContext {&lt;br /&gt;
    ...&lt;br /&gt;
    Canvas2DContextAttributes getContextAttributes();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Rationale: ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why not add a new element attribute instead?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Implementing the same syntax as WebGL brings consistency to the web platform, obeys the principle of least surprise for developers.  It also may allow more code sharing in JavaScript, since with duck typing, the same object can be used for both canvas and WebGL.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Can you call getContext more than once on the same canvas, with different values for { alpha }?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; No.  Once it has been called once, the type of the backing store is set.  Calling it again with a different argument raises an exception.&lt;br /&gt;
&lt;br /&gt;
== Issues: ==&lt;br /&gt;
&lt;br /&gt;
=== Implementing non-alpha-modifying compositing modes may be difficult in some 2D graphics APIs ===&lt;br /&gt;
&lt;br /&gt;
The CoreGraphics API provides a mechanism to specify an opaque backing store, via kCGImageAlphaNoneSkipLast.  However, it seems that IOSurfaces do not.&lt;br /&gt;
&lt;br /&gt;
How the different APIs which do support such a mechanism behave with respect to different compositing modes is also TBD.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>StephenWhite</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=CanvasOpaque&amp;diff=9098</id>
		<title>CanvasOpaque</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=CanvasOpaque&amp;diff=9098"/>
		<updated>2013-04-17T22:42:28Z</updated>

		<summary type="html">&lt;p&gt;StephenWhite: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;This proposal is to allow the specification of an opaque backing store for 2D Canvas, to optimize blending and culling.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Use case: A 2D UI is written using canvas which is attempting to achieve top performance.  It clears its backing store to opaque, and only uses non-alpha-modifying canvas commands, but since the user agent cannot determine this empirically from an arbitrary set of canvas commands, it cannot optimize the blending and culling of obscured elements when compositing the canvas into the page.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
Many sites already draw only opaque canvases, but have no way to convey this to the user agent.  There is no known workaround for performance.&lt;br /&gt;
&lt;br /&gt;
Compositing a &amp;lt;canvas&amp;gt; element into the page can be expensive, due to blending operations, and lack of opportunity for culling.  Since arbitrary graphics operations can affect the opacity of the canvas, it is difficult to determine programmatically whether the canvas is opaque.  Allowing the developer to explicitly mark a canvas as opaque allows the user agent to optimize blending at page composite time, as well to cull fully-obscured elements behind the canvas.&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
# Allow the specification of an opaque backing store for canvas.&lt;br /&gt;
# Modify all canvas operations to respect the opaque backing store (i.e., to leave all per-pixel alpha at 1.0).&lt;br /&gt;
# Allow the user agent to easily optimize compositing and culling of the canvas.&lt;br /&gt;
&lt;br /&gt;
== Non Goals ==&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
One proposed solution was the &amp;lt;code&amp;gt;opaque&amp;lt;/code&amp;gt; attribute on the &amp;lt;code&amp;gt;canvas&amp;lt;/code&amp;gt; element. This was implemented by Mozilla and has been shipping in Firefox as the &amp;lt;code&amp;gt;moz-opaque&amp;lt;/code&amp;gt; attribute. Semantically, this is exactly what we want. However, it does not match WebGL syntax.&lt;br /&gt;
&lt;br /&gt;
=== Suggested Solution ===&lt;br /&gt;
&lt;br /&gt;
Allow an optional parameter to the Canvas element&#039;s &amp;lt;code&amp;gt;getContext&amp;lt;/code&amp;gt; method, which specifies the context creation parameter object.  The object contains the boolean &amp;lt;code&amp;gt;alpha&amp;lt;/code&amp;gt; property:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    var ctx = canvas.getContext(&#039;2d&#039;, { alpha: false });&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Suggested IDL ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
interface Canvas2DContextAttributes {&lt;br /&gt;
    attribute boolean alpha;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
interface Canvas2DRenderingContext {&lt;br /&gt;
    ...&lt;br /&gt;
    Canvas2DContextAttributes getContextAttributes();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Rationale: ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why not add a new element attribute instead?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Implementing the same syntax as WebGL brings consistency to the web platform, obeys the principle of least surprise for developers.  It also may allow more code sharing in JavaScript, since with duck typing, the same object can be used for both.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Can you call getContext more than once on the same canvas, with different values for { alpha }?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; No.  Once it has been called once, the type of the backing store is set.  Calling it again with a different argument raises an exception.&lt;br /&gt;
== Issues: ==&lt;br /&gt;
&lt;br /&gt;
=== Implementing non-alpha-modifying compositing modes may be difficult in some 2D graphics APIs ===&lt;br /&gt;
&lt;br /&gt;
The CoreGraphics API provides a mechanism to specify an opaque backing store, via kCGImageAlphaNoneSkipLast.  However, it seems that IOSurfaces do not.&lt;br /&gt;
&lt;br /&gt;
How the different APIs which do support such a mechanism behave with respect to different compositing modes is also TBD.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>StephenWhite</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=CanvasOpaque&amp;diff=9097</id>
		<title>CanvasOpaque</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=CanvasOpaque&amp;diff=9097"/>
		<updated>2013-04-17T19:48:04Z</updated>

		<summary type="html">&lt;p&gt;StephenWhite: /* Goals */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;This proposal is allowing the specification of an opaque backing store for 2D Canvas, to optimize blending and culling.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Use case: A 2D UI is written using canvas which is attempting to achieve top performance.  It clears its backing store to opaque, and only uses non-alpha-modifying canvas commands, but since the user agent cannot determine this empirically from an arbitrary set of canvas commands, it cannot optimize the blending and culling of obscured elements when compositing the canvas into the page.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
Many sites already draw only opaque canvases, but have no way to convey this to the user agent.  There is no known workaround for performance.&lt;br /&gt;
&lt;br /&gt;
Compositing a &amp;lt;canvas&amp;gt; element into the page can be expensive, due to blending operations, and lack of opportunity for culling.  Since arbitrary graphics operations can affect the opacity of the canvas, it is difficult to determine programmatically whether the canvas is opaque.  Allowing the developer to explicitly mark a canvas as opaque allows the user agent to optimize blending at page composite time, as well to cull fully-obscured elements behind the canvas.&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
# Allow the specification of an opaque backing store for canvas.&lt;br /&gt;
# Modify all canvas operations to respect the opaque backing store (i.e., to leave all per-pixel alpha at 1.0).&lt;br /&gt;
# Allow the user agent to easily optimize compositing and culling of the canvas.&lt;br /&gt;
&lt;br /&gt;
== Non Goals ==&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
One proposed solution was the &amp;lt;code&amp;gt;opaque&amp;lt;/code&amp;gt; attribute on the &amp;lt;code&amp;gt;canvas&amp;lt;/code&amp;gt; element. This was implemented by Mozilla and has been shipping in Firefox as the &amp;lt;code&amp;gt;moz-opaque&amp;lt;/code&amp;gt; attribute. Semantically, this is exactly what we want. However, it does not match WebGL syntax.&lt;br /&gt;
&lt;br /&gt;
=== Suggested Solution ===&lt;br /&gt;
&lt;br /&gt;
Allow an optional parameter to the Canvas element&#039;s &amp;lt;code&amp;gt;getContext&amp;lt;/code&amp;gt; method, which specifies the context creation parameter object.  The object contains the boolean &amp;lt;code&amp;gt;alpha&amp;lt;/code&amp;gt; property:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    var ctx = canvas.getContext(&#039;2d&#039;, { alpha: false });&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Suggested IDL ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
interface Canvas2DContextAttributes {&lt;br /&gt;
    attribute boolean alpha;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
interface Canvas2DRenderingContext {&lt;br /&gt;
    ...&lt;br /&gt;
    Canvas2DContextAttributes getContextAttributes();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Rationale: ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why not add a new element attribute instead?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Implementing the same syntax as WebGL brings consistency to the web platform, obeys the principle of least surprise for developers.  It also may allow more code sharing in JavaScript, since with duck typing, the same object can be used for both.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Can you call getContext more than once on the same canvas, with different values for { alpha }?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; No.  Once it has been called once, the type of the backing store is set.  Calling it again with a different argument raises an exception.&lt;br /&gt;
== Issues: ==&lt;br /&gt;
&lt;br /&gt;
=== Implementing non-alpha-modifying compositing modes may be difficult in some 2D graphics APIs ===&lt;br /&gt;
&lt;br /&gt;
The CoreGraphics API provides a mechanism to specify an opaque backing store, via kCGImageAlphaNoneSkipLast.  However, it seems that IOSurfaces do not.&lt;br /&gt;
&lt;br /&gt;
How the different APIs which do support such a mechanism behave with respect to different compositing modes is also TBD.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>StephenWhite</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=CanvasOpaque&amp;diff=9096</id>
		<title>CanvasOpaque</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=CanvasOpaque&amp;diff=9096"/>
		<updated>2013-04-17T16:06:19Z</updated>

		<summary type="html">&lt;p&gt;StephenWhite: /* Goals */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;This proposal is allowing the specification of an opaque backing store for 2D Canvas, to optimize blending and culling.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Use case: A 2D UI is written using canvas which is attempting to achieve top performance.  It clears its backing store to opaque, and only uses non-alpha-modifying canvas commands, but since the user agent cannot determine this empirically from an arbitrary set of canvas commands, it cannot optimize the blending and culling of obscured elements when compositing the canvas into the page.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
Many sites already draw only opaque canvases, but have no way to convey this to the user agent.  There is no known workaround for performance.&lt;br /&gt;
&lt;br /&gt;
Compositing a &amp;lt;canvas&amp;gt; element into the page can be expensive, due to blending operations, and lack of opportunity for culling.  Since arbitrary graphics operations can affect the opacity of the canvas, it is difficult to determine programmatically whether the canvas is opaque.  Allowing the developer to explicitly mark a canvas as opaque allows the user agent to optimize blending at page composite time, as well to cull fully-obscured elements behind the canvas.&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
# Allow the specification of an opaque backing store for canvas.&lt;br /&gt;
# Modify all canvas operations to respect the opaque backing store (and leave it at alpha 1.0).&lt;br /&gt;
# Allow the user agent to easily optimize compositing and culling of the canvas.&lt;br /&gt;
&lt;br /&gt;
== Non Goals ==&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
One proposed solution was the &amp;lt;code&amp;gt;opaque&amp;lt;/code&amp;gt; attribute on the &amp;lt;code&amp;gt;canvas&amp;lt;/code&amp;gt; element. This was implemented by Mozilla and has been shipping in Firefox as the &amp;lt;code&amp;gt;moz-opaque&amp;lt;/code&amp;gt; attribute. Semantically, this is exactly what we want. However, it does not match WebGL syntax.&lt;br /&gt;
&lt;br /&gt;
=== Suggested Solution ===&lt;br /&gt;
&lt;br /&gt;
Allow an optional parameter to the Canvas element&#039;s &amp;lt;code&amp;gt;getContext&amp;lt;/code&amp;gt; method, which specifies the context creation parameter object.  The object contains the boolean &amp;lt;code&amp;gt;alpha&amp;lt;/code&amp;gt; property:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    var ctx = canvas.getContext(&#039;2d&#039;, { alpha: false });&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Suggested IDL ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
interface Canvas2DContextAttributes {&lt;br /&gt;
    attribute boolean alpha;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
interface Canvas2DRenderingContext {&lt;br /&gt;
    ...&lt;br /&gt;
    Canvas2DContextAttributes getContextAttributes();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Rationale: ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why not add a new element attribute instead?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Implementing the same syntax as WebGL brings consistency to the web platform, obeys the principle of least surprise for developers.  It also may allow more code sharing in JavaScript, since with duck typing, the same object can be used for both.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Can you call getContext more than once on the same canvas, with different values for { alpha }?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; No.  Once it has been called once, the type of the backing store is set.  Calling it again with a different argument raises an exception.&lt;br /&gt;
== Issues: ==&lt;br /&gt;
&lt;br /&gt;
=== Implementing non-alpha-modifying compositing modes may be difficult in some 2D graphics APIs ===&lt;br /&gt;
&lt;br /&gt;
The CoreGraphics API provides a mechanism to specify an opaque backing store, via kCGImageAlphaNoneSkipLast.  However, it seems that IOSurfaces do not.&lt;br /&gt;
&lt;br /&gt;
How the different APIs which do support such a mechanism behave with respect to different compositing modes is also TBD.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>StephenWhite</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=CanvasOpaque&amp;diff=9095</id>
		<title>CanvasOpaque</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=CanvasOpaque&amp;diff=9095"/>
		<updated>2013-04-17T16:04:27Z</updated>

		<summary type="html">&lt;p&gt;StephenWhite: /* Implementing non-alpha-modifying compositing modes may be difficult in some 2D graphics APIs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;This proposal is allowing the specification of an opaque backing store for 2D Canvas, to optimize blending and culling.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Use case: A 2D UI is written using canvas which is attempting to achieve top performance.  It clears its backing store to opaque, and only uses non-alpha-modifying canvas commands, but since the user agent cannot determine this empirically from an arbitrary set of canvas commands, it cannot optimize the blending and culling of obscured elements when compositing the canvas into the page.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
Many sites already draw only opaque canvases, but have no way to convey this to the user agent.  There is no known workaround for performance.&lt;br /&gt;
&lt;br /&gt;
Compositing a &amp;lt;canvas&amp;gt; element into the page can be expensive, due to blending operations, and lack of opportunity for culling.  Since arbitrary graphics operations can affect the opacity of the canvas, it is difficult to determine programmatically whether the canvas is opaque.  Allowing the developer to explicitly mark a canvas as opaque allows the user agent to optimize blending at page composite time, as well to cull fully-obscured elements behind the canvas.&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
# Allow the specification of an opaque backing store at getContext() time.&lt;br /&gt;
# Allow the user agent to easily optimize compositing and culling of the canvas.&lt;br /&gt;
&lt;br /&gt;
== Non Goals ==&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
One proposed solution was the &amp;lt;code&amp;gt;opaque&amp;lt;/code&amp;gt; attribute on the &amp;lt;code&amp;gt;canvas&amp;lt;/code&amp;gt; element. This was implemented by Mozilla and has been shipping in Firefox as the &amp;lt;code&amp;gt;moz-opaque&amp;lt;/code&amp;gt; attribute. Semantically, this is exactly what we want. However, it does not match WebGL syntax.&lt;br /&gt;
&lt;br /&gt;
=== Suggested Solution ===&lt;br /&gt;
&lt;br /&gt;
Allow an optional parameter to the Canvas element&#039;s &amp;lt;code&amp;gt;getContext&amp;lt;/code&amp;gt; method, which specifies the context creation parameter object.  The object contains the boolean &amp;lt;code&amp;gt;alpha&amp;lt;/code&amp;gt; property:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    var ctx = canvas.getContext(&#039;2d&#039;, { alpha: false });&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Suggested IDL ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
interface Canvas2DContextAttributes {&lt;br /&gt;
    attribute boolean alpha;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
interface Canvas2DRenderingContext {&lt;br /&gt;
    ...&lt;br /&gt;
    Canvas2DContextAttributes getContextAttributes();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Rationale: ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why not add a new element attribute instead?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Implementing the same syntax as WebGL brings consistency to the web platform, obeys the principle of least surprise for developers.  It also may allow more code sharing in JavaScript, since with duck typing, the same object can be used for both.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Can you call getContext more than once on the same canvas, with different values for { alpha }?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; No.  Once it has been called once, the type of the backing store is set.  Calling it again with a different argument raises an exception.&lt;br /&gt;
== Issues: ==&lt;br /&gt;
&lt;br /&gt;
=== Implementing non-alpha-modifying compositing modes may be difficult in some 2D graphics APIs ===&lt;br /&gt;
&lt;br /&gt;
The CoreGraphics API provides a mechanism to specify an opaque backing store, via kCGImageAlphaNoneSkipLast.  However, it seems that IOSurfaces do not.&lt;br /&gt;
&lt;br /&gt;
How the different APIs which do support such a mechanism behave with respect to different compositing modes is also TBD.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>StephenWhite</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=CanvasOpaque&amp;diff=9094</id>
		<title>CanvasOpaque</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=CanvasOpaque&amp;diff=9094"/>
		<updated>2013-04-17T16:03:41Z</updated>

		<summary type="html">&lt;p&gt;StephenWhite: /* Proposed Solutions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;This proposal is allowing the specification of an opaque backing store for 2D Canvas, to optimize blending and culling.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Use case: A 2D UI is written using canvas which is attempting to achieve top performance.  It clears its backing store to opaque, and only uses non-alpha-modifying canvas commands, but since the user agent cannot determine this empirically from an arbitrary set of canvas commands, it cannot optimize the blending and culling of obscured elements when compositing the canvas into the page.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
Many sites already draw only opaque canvases, but have no way to convey this to the user agent.  There is no known workaround for performance.&lt;br /&gt;
&lt;br /&gt;
Compositing a &amp;lt;canvas&amp;gt; element into the page can be expensive, due to blending operations, and lack of opportunity for culling.  Since arbitrary graphics operations can affect the opacity of the canvas, it is difficult to determine programmatically whether the canvas is opaque.  Allowing the developer to explicitly mark a canvas as opaque allows the user agent to optimize blending at page composite time, as well to cull fully-obscured elements behind the canvas.&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
# Allow the specification of an opaque backing store at getContext() time.&lt;br /&gt;
# Allow the user agent to easily optimize compositing and culling of the canvas.&lt;br /&gt;
&lt;br /&gt;
== Non Goals ==&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
One proposed solution was the &amp;lt;code&amp;gt;opaque&amp;lt;/code&amp;gt; attribute on the &amp;lt;code&amp;gt;canvas&amp;lt;/code&amp;gt; element. This was implemented by Mozilla and has been shipping in Firefox as the &amp;lt;code&amp;gt;moz-opaque&amp;lt;/code&amp;gt; attribute. Semantically, this is exactly what we want. However, it does not match WebGL syntax.&lt;br /&gt;
&lt;br /&gt;
=== Suggested Solution ===&lt;br /&gt;
&lt;br /&gt;
Allow an optional parameter to the Canvas element&#039;s &amp;lt;code&amp;gt;getContext&amp;lt;/code&amp;gt; method, which specifies the context creation parameter object.  The object contains the boolean &amp;lt;code&amp;gt;alpha&amp;lt;/code&amp;gt; property:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    var ctx = canvas.getContext(&#039;2d&#039;, { alpha: false });&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Suggested IDL ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
interface Canvas2DContextAttributes {&lt;br /&gt;
    attribute boolean alpha;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
interface Canvas2DRenderingContext {&lt;br /&gt;
    ...&lt;br /&gt;
    Canvas2DContextAttributes getContextAttributes();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Rationale: ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why not add a new element attribute instead?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Implementing the same syntax as WebGL brings consistency to the web platform, obeys the principle of least surprise for developers.  It also may allow more code sharing in JavaScript, since with duck typing, the same object can be used for both.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Can you call getContext more than once on the same canvas, with different values for { alpha }?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; No.  Once it has been called once, the type of the backing store is set.  Calling it again with a different argument raises an exception.&lt;br /&gt;
== Issues: ==&lt;br /&gt;
&lt;br /&gt;
= Implementing non-alpha-modifying compositing modes may be difficult in some 2D graphics APIs =&lt;br /&gt;
&lt;br /&gt;
The CoreGraphics API provides a mechanism to specify an opaque backing store, via kCGImageAlphaNoneSkipLast.  However, it seems that IOSurfaces do not.&lt;br /&gt;
&lt;br /&gt;
How the different APIs which do support such a mechanism behave with respect to different compositing modes is also TBD.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>StephenWhite</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=CanvasOpaque&amp;diff=9093</id>
		<title>CanvasOpaque</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=CanvasOpaque&amp;diff=9093"/>
		<updated>2013-04-17T16:03:16Z</updated>

		<summary type="html">&lt;p&gt;StephenWhite: /* Proposed Solutions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;This proposal is allowing the specification of an opaque backing store for 2D Canvas, to optimize blending and culling.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Use case: A 2D UI is written using canvas which is attempting to achieve top performance.  It clears its backing store to opaque, and only uses non-alpha-modifying canvas commands, but since the user agent cannot determine this empirically from an arbitrary set of canvas commands, it cannot optimize the blending and culling of obscured elements when compositing the canvas into the page.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
Many sites already draw only opaque canvases, but have no way to convey this to the user agent.  There is no known workaround for performance.&lt;br /&gt;
&lt;br /&gt;
Compositing a &amp;lt;canvas&amp;gt; element into the page can be expensive, due to blending operations, and lack of opportunity for culling.  Since arbitrary graphics operations can affect the opacity of the canvas, it is difficult to determine programmatically whether the canvas is opaque.  Allowing the developer to explicitly mark a canvas as opaque allows the user agent to optimize blending at page composite time, as well to cull fully-obscured elements behind the canvas.&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
# Allow the specification of an opaque backing store at getContext() time.&lt;br /&gt;
# Allow the user agent to easily optimize compositing and culling of the canvas.&lt;br /&gt;
&lt;br /&gt;
== Non Goals ==&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
One proposed solution was the &amp;lt;code&amp;gt;opaque&amp;gt;/code&amp;gt; attribute on the &amp;lt;code&amp;gt;canvas&amp;lt;/code&amp;gt; element. This was implemented by Mozilla and has been shipping in Firefox as the &amp;lt;code&amp;gt;moz-opaque&amp;lt;/code&amp;gt; attribute. Semantically, this is exactly what we want. However, it does not match WebGL syntax.&lt;br /&gt;
&lt;br /&gt;
=== Suggested Solution ===&lt;br /&gt;
&lt;br /&gt;
Allow an optional parameter to the Canvas element&#039;s &amp;lt;code&amp;gt;getContext&amp;lt;/code&amp;gt; method, which specifies the context creation parameter object.  The object contains the boolean &amp;lt;code&amp;gt;alpha&amp;lt;/code&amp;gt; property:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    var ctx = canvas.getContext(&#039;2d&#039;, { alpha: false });&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Suggested IDL ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
interface Canvas2DContextAttributes {&lt;br /&gt;
    attribute boolean alpha;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
interface Canvas2DRenderingContext {&lt;br /&gt;
    ...&lt;br /&gt;
    Canvas2DContextAttributes getContextAttributes();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Rationale: ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why not add a new element attribute instead?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Implementing the same syntax as WebGL brings consistency to the web platform, obeys the principle of least surprise for developers.  It also may allow more code sharing in JavaScript, since with duck typing, the same object can be used for both.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Can you call getContext more than once on the same canvas, with different values for { alpha }?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; No.  Once it has been called once, the type of the backing store is set.  Calling it again with a different argument raises an exception.&lt;br /&gt;
== Issues: ==&lt;br /&gt;
&lt;br /&gt;
= Implementing non-alpha-modifying compositing modes may be difficult in some 2D graphics APIs =&lt;br /&gt;
&lt;br /&gt;
The CoreGraphics API provides a mechanism to specify an opaque backing store, via kCGImageAlphaNoneSkipLast.  However, it seems that IOSurfaces do not.&lt;br /&gt;
&lt;br /&gt;
How the different APIs which do support such a mechanism behave with respect to different compositing modes is also TBD.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>StephenWhite</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=CanvasOpaque&amp;diff=9092</id>
		<title>CanvasOpaque</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=CanvasOpaque&amp;diff=9092"/>
		<updated>2013-04-17T16:01:39Z</updated>

		<summary type="html">&lt;p&gt;StephenWhite: /* Proposed Solutions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;This proposal is allowing the specification of an opaque backing store for 2D Canvas, to optimize blending and culling.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Use case: A 2D UI is written using canvas which is attempting to achieve top performance.  It clears its backing store to opaque, and only uses non-alpha-modifying canvas commands, but since the user agent cannot determine this empirically from an arbitrary set of canvas commands, it cannot optimize the blending and culling of obscured elements when compositing the canvas into the page.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
Many sites already draw only opaque canvases, but have no way to convey this to the user agent.  There is no known workaround for performance.&lt;br /&gt;
&lt;br /&gt;
Compositing a &amp;lt;canvas&amp;gt; element into the page can be expensive, due to blending operations, and lack of opportunity for culling.  Since arbitrary graphics operations can affect the opacity of the canvas, it is difficult to determine programmatically whether the canvas is opaque.  Allowing the developer to explicitly mark a canvas as opaque allows the user agent to optimize blending at page composite time, as well to cull fully-obscured elements behind the canvas.&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
# Allow the specification of an opaque backing store at getContext() time.&lt;br /&gt;
# Allow the user agent to easily optimize compositing and culling of the canvas.&lt;br /&gt;
&lt;br /&gt;
== Non Goals ==&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
One proposed solution was implemented by Mozilla as the &amp;lt;code&amp;gt;mozOpaque&amp;lt;/code&amp;gt; attribute on the &amp;lt;code&amp;gt;canvas&amp;lt;/code&amp;gt; element.  Semantically, this is exactly what we want.  However, it does not match WebGL syntax, which already has such an API.&lt;br /&gt;
&lt;br /&gt;
=== Suggested Solution ===&lt;br /&gt;
&lt;br /&gt;
Allow an optional parameter to the Canvas element&#039;s &amp;lt;code&amp;gt;getContext&amp;lt;/code&amp;gt; method, which specifies the context creation parameter object.  The object contains the boolean &amp;lt;code&amp;gt;alpha&amp;lt;/code&amp;gt; property:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    var ctx = canvas.getContext(&#039;2d&#039;, { alpha: false });&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Suggested IDL ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
interface Canvas2DContextAttributes {&lt;br /&gt;
    attribute boolean alpha;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
interface Canvas2DRenderingContext {&lt;br /&gt;
    ...&lt;br /&gt;
    Canvas2DContextAttributes getContextAttributes();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Rationale: ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why not add a new element attribute instead?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Implementing the same syntax as WebGL brings consistency to the web platform, obeys the principle of least surprise for developers.  It also may allow more code sharing in JavaScript, since with duck typing, the same object can be used for both.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Can you call getContext more than once on the same canvas, with different values for { alpha }?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; No.  Once it has been called once, the type of the backing store is set.  Calling it again with a different argument raises an exception.&lt;br /&gt;
== Issues: ==&lt;br /&gt;
&lt;br /&gt;
= Implementing non-alpha-modifying compositing modes may be difficult in some 2D graphics APIs =&lt;br /&gt;
&lt;br /&gt;
The CoreGraphics API provides a mechanism to specify an opaque backing store, via kCGImageAlphaNoneSkipLast.  However, it seems that IOSurfaces do not.&lt;br /&gt;
&lt;br /&gt;
How the different APIs which do support such a mechanism behave with respect to different compositing modes is also TBD.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>StephenWhite</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=CanvasOpaque&amp;diff=9091</id>
		<title>CanvasOpaque</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=CanvasOpaque&amp;diff=9091"/>
		<updated>2013-04-17T15:51:22Z</updated>

		<summary type="html">&lt;p&gt;StephenWhite: /* Suggested Solution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;This proposal is allowing the specification of an opaque backing store for 2D Canvas, to optimize blending and culling.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Use case: A 2D UI is written using canvas which is attempting to achieve top performance.  It clears its backing store to opaque, and only uses non-alpha-modifying canvas commands, but since the user agent cannot determine this empirically from an arbitrary set of canvas commands, it cannot optimize the blending and culling of obscured elements when compositing the canvas into the page.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
Many sites already draw only opaque canvases, but have no way to convey this to the user agent.  There is no known workaround for performance.&lt;br /&gt;
&lt;br /&gt;
Compositing a &amp;lt;canvas&amp;gt; element into the page can be expensive, due to blending operations, and lack of opportunity for culling.  Since arbitrary graphics operations can affect the opacity of the canvas, it is difficult to determine programmatically whether the canvas is opaque.  Allowing the developer to explicitly mark a canvas as opaque allows the user agent to optimize blending at page composite time, as well to cull fully-obscured elements behind the canvas.&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
# Allow the specification of an opaque backing store at getContext() time.&lt;br /&gt;
# Allow the user agent to easily optimize compositing and culling of the canvas.&lt;br /&gt;
&lt;br /&gt;
== Non Goals ==&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
One proposed solution was implemented by Mozilla as the &amp;lt;tt&amp;gt;mozOpaque&amp;gt; attribute on the &amp;lt;tt&amp;gt;canvas&amp;lt;/tt&amp;gt; element.  Semantically, this is exactly what we want.  However, it does not match WebGL semantics, which already has such an API.&lt;br /&gt;
&lt;br /&gt;
=== Suggested Solution ===&lt;br /&gt;
&lt;br /&gt;
Allow an optional parameter to the Canvas element&#039;s &amp;lt;code&amp;gt;getContext&amp;lt;/code&amp;gt; method, which specifies the context creation parameter object.  The object contains the boolean &amp;quot;alpha&amp;quot; property:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    var ctx = canvas.getContext(&#039;2d&#039;, { alpha: false });&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Suggested IDL ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
interface Canvas2DContextAttributes {&lt;br /&gt;
    attribute boolean alpha;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
interface Canvas2DRenderingContext {&lt;br /&gt;
    ...&lt;br /&gt;
    Canvas2DContextAttributes getContextAttributes();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Rationale: ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why not add a new element attribute instead?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Implementing the same syntax as WebGL brings consistency to the web platform, obeys the principle of least surprise for developers.  It also may allow more code sharing in JavaScript, since with duck typing, the same object can be used for both.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Can you call getContext more than once on the same canvas, with different values for { alpha }?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; No.  Once it has been called once, the type of the backing store is set.  Calling it again with a different argument raises an exception.&lt;br /&gt;
== Issues: ==&lt;br /&gt;
&lt;br /&gt;
= Implementing non-alpha-modifying compositing modes may be difficult in some 2D graphics APIs =&lt;br /&gt;
&lt;br /&gt;
The CoreGraphics API provides a mechanism to specify an opaque backing store, via kCGImageAlphaNoneSkipLast.  However, it seems that IOSurfaces do not.&lt;br /&gt;
&lt;br /&gt;
How the different APIs which do support such a mechanism behave with respect to different compositing modes is also TBD.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>StephenWhite</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=CanvasOpaque&amp;diff=9089</id>
		<title>CanvasOpaque</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=CanvasOpaque&amp;diff=9089"/>
		<updated>2013-04-16T22:08:44Z</updated>

		<summary type="html">&lt;p&gt;StephenWhite: /* Implementing non-alpha-modifying compositing modes may be difficult in some 2D graphics APIs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;This proposal is allowing the specification of an opaque backing store for 2D Canvas, to optimize blending and culling.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Use case: A 2D UI is written using canvas which is attempting to achieve top performance.  It clears its backing store to opaque, and only uses non-alpha-modifying canvas commands, but since the user agent cannot determine this empirically from an arbitrary set of canvas commands, it cannot optimize the blending and culling of obscured elements when compositing the canvas into the page.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
Many sites already draw only opaque canvases, but have no way to convey this to the user agent.  There is no known workaround for performance.&lt;br /&gt;
&lt;br /&gt;
Compositing a &amp;lt;canvas&amp;gt; element into the page can be expensive, due to blending operations, and lack of opportunity for culling.  Since arbitrary graphics operations can affect the opacity of the canvas, it is difficult to determine programmatically whether the canvas is opaque.  Allowing the developer to explicitly mark a canvas as opaque allows the user agent to optimize blending at page composite time, as well to cull fully-obscured elements behind the canvas.&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
# Allow the specification of an opaque backing store at getContext() time.&lt;br /&gt;
# Allow the user agent to easily optimize compositing and culling of the canvas.&lt;br /&gt;
&lt;br /&gt;
== Non Goals ==&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
One proposed solution was implemented by Mozilla as the &amp;lt;tt&amp;gt;mozOpaque&amp;gt; attribute on the &amp;lt;tt&amp;gt;canvas&amp;lt;/tt&amp;gt; element.  Semantically, this is exactly what we want.  However, it does not match WebGL semantics, which already has such an API.&lt;br /&gt;
&lt;br /&gt;
=== Suggested Solution ===&lt;br /&gt;
&lt;br /&gt;
Allow an optional parameter to the Canvas element&#039;s &amp;lt;tt&amp;gt;getContext&amp;lt;/tt&amp;gt; method, which can specify the &amp;quot;alpha&amp;quot; context creation parameter:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    var ctx = canvas.getContext(&#039;2d&#039;, { alpha: false });&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Suggested IDL ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
interface Canvas2DContextAttributes {&lt;br /&gt;
    attribute boolean alpha;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
interface Canvas2DRenderingContext {&lt;br /&gt;
    ...&lt;br /&gt;
    Canvas2DContextAttributes getContextAttributes();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Rationale: ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why not add a new element attribute instead?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Implementing the same syntax as WebGL brings consistency to the web platform, obeys the principle of least surprise for developers.  It also may allow more code sharing in JavaScript, since with duck typing, the same object can be used for both.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Can you call getContext more than once on the same canvas, with different values for { alpha }?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; No.  Once it has been called once, the type of the backing store is set.  Calling it again with a different argument raises an exception.&lt;br /&gt;
== Issues: ==&lt;br /&gt;
&lt;br /&gt;
= Implementing non-alpha-modifying compositing modes may be difficult in some 2D graphics APIs =&lt;br /&gt;
&lt;br /&gt;
The CoreGraphics API provides a mechanism to specify an opaque backing store, via kCGImageAlphaNoneSkipLast.  However, it seems that IOSurfaces do not.&lt;br /&gt;
&lt;br /&gt;
How the different APIs which do support such a mechanism behave with respect to different compositing modes is also TBD.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>StephenWhite</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=CanvasOpaque&amp;diff=9088</id>
		<title>CanvasOpaque</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=CanvasOpaque&amp;diff=9088"/>
		<updated>2013-04-16T21:58:57Z</updated>

		<summary type="html">&lt;p&gt;StephenWhite: /* Current Usage and Workarounds */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;This proposal is allowing the specification of an opaque backing store for 2D Canvas, to optimize blending and culling.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Use case: A 2D UI is written using canvas which is attempting to achieve top performance.  It clears its backing store to opaque, and only uses non-alpha-modifying canvas commands, but since the user agent cannot determine this empirically from an arbitrary set of canvas commands, it cannot optimize the blending and culling of obscured elements when compositing the canvas into the page.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
Many sites already draw only opaque canvases, but have no way to convey this to the user agent.  There is no known workaround for performance.&lt;br /&gt;
&lt;br /&gt;
Compositing a &amp;lt;canvas&amp;gt; element into the page can be expensive, due to blending operations, and lack of opportunity for culling.  Since arbitrary graphics operations can affect the opacity of the canvas, it is difficult to determine programmatically whether the canvas is opaque.  Allowing the developer to explicitly mark a canvas as opaque allows the user agent to optimize blending at page composite time, as well to cull fully-obscured elements behind the canvas.&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
# Allow the specification of an opaque backing store at getContext() time.&lt;br /&gt;
# Allow the user agent to easily optimize compositing and culling of the canvas.&lt;br /&gt;
&lt;br /&gt;
== Non Goals ==&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
One proposed solution was implemented by Mozilla as the &amp;lt;tt&amp;gt;mozOpaque&amp;gt; attribute on the &amp;lt;tt&amp;gt;canvas&amp;lt;/tt&amp;gt; element.  Semantically, this is exactly what we want.  However, it does not match WebGL semantics, which already has such an API.&lt;br /&gt;
&lt;br /&gt;
=== Suggested Solution ===&lt;br /&gt;
&lt;br /&gt;
Allow an optional parameter to the Canvas element&#039;s &amp;lt;tt&amp;gt;getContext&amp;lt;/tt&amp;gt; method, which can specify the &amp;quot;alpha&amp;quot; context creation parameter:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    var ctx = canvas.getContext(&#039;2d&#039;, { alpha: false });&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Suggested IDL ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
interface Canvas2DContextAttributes {&lt;br /&gt;
    attribute boolean alpha;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
interface Canvas2DRenderingContext {&lt;br /&gt;
    ...&lt;br /&gt;
    Canvas2DContextAttributes getContextAttributes();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Rationale: ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why not add a new element attribute instead?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Implementing the same syntax as WebGL brings consistency to the web platform, obeys the principle of least surprise for developers.  It also may allow more code sharing in JavaScript, since with duck typing, the same object can be used for both.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Can you call getContext more than once on the same canvas, with different values for { alpha }?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; No.  Once it has been called once, the type of the backing store is set.  Calling it again with a different argument raises an exception.&lt;br /&gt;
== Issues: ==&lt;br /&gt;
&lt;br /&gt;
=== Implementing non-alpha-modifying compositing modes may be difficult in some 2D graphics APIs ===&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>StephenWhite</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=CanvasOpaque&amp;diff=9087</id>
		<title>CanvasOpaque</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=CanvasOpaque&amp;diff=9087"/>
		<updated>2013-04-16T21:58:18Z</updated>

		<summary type="html">&lt;p&gt;StephenWhite: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;This proposal is allowing the specification of an opaque backing store for 2D Canvas, to optimize blending and culling.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Use case: A 2D UI is written using canvas which is attempting to achieve top performance.  It clears its backing store to opaque, and only uses non-alpha-modifying canvas commands, but since the user agent cannot determine this empirically from an arbitrary set of canvas commands, it cannot optimize the blending and culling of obscured elements when compositing the canvas into the page.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
Many sites already draw only opaque canvases, but have no way to convey this to the user agent.  Using WebGL might be a (rather heavy-handed) workaround in some cases, since WebGL already provides this API.&lt;br /&gt;
&lt;br /&gt;
Compositing a &amp;lt;canvas&amp;gt; element into the page can be expensive, due to blending operations, and lack of opportunity for culling.  Since arbitrary graphics operations can affect the opacity of the canvas, it is difficult to determine programmatically whether the canvas is opaque.  Allowing the developer to explicitly mark a canvas as opaque allows the user agent to optimize blending at page composite time, as well to cull fully-obscured elements behind the canvas.&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
# Allow the specification of an opaque backing store at getContext() time.&lt;br /&gt;
# Allow the user agent to easily optimize compositing and culling of the canvas.&lt;br /&gt;
&lt;br /&gt;
== Non Goals ==&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
One proposed solution was implemented by Mozilla as the &amp;lt;tt&amp;gt;mozOpaque&amp;gt; attribute on the &amp;lt;tt&amp;gt;canvas&amp;lt;/tt&amp;gt; element.  Semantically, this is exactly what we want.  However, it does not match WebGL semantics, which already has such an API.&lt;br /&gt;
&lt;br /&gt;
=== Suggested Solution ===&lt;br /&gt;
&lt;br /&gt;
Allow an optional parameter to the Canvas element&#039;s &amp;lt;tt&amp;gt;getContext&amp;lt;/tt&amp;gt; method, which can specify the &amp;quot;alpha&amp;quot; context creation parameter:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    var ctx = canvas.getContext(&#039;2d&#039;, { alpha: false });&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Suggested IDL ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
interface Canvas2DContextAttributes {&lt;br /&gt;
    attribute boolean alpha;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
interface Canvas2DRenderingContext {&lt;br /&gt;
    ...&lt;br /&gt;
    Canvas2DContextAttributes getContextAttributes();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Rationale: ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why not add a new element attribute instead?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Implementing the same syntax as WebGL brings consistency to the web platform, obeys the principle of least surprise for developers.  It also may allow more code sharing in JavaScript, since with duck typing, the same object can be used for both.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Can you call getContext more than once on the same canvas, with different values for { alpha }?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; No.  Once it has been called once, the type of the backing store is set.  Calling it again with a different argument raises an exception.&lt;br /&gt;
== Issues: ==&lt;br /&gt;
&lt;br /&gt;
=== Implementing non-alpha-modifying compositing modes may be difficult in some 2D graphics APIs ===&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>StephenWhite</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=CanvasOpaque&amp;diff=9086</id>
		<title>CanvasOpaque</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=CanvasOpaque&amp;diff=9086"/>
		<updated>2013-04-16T21:57:46Z</updated>

		<summary type="html">&lt;p&gt;StephenWhite: Created page with &amp;quot;Description:  The &amp;quot;opaque&amp;quot; attribute is a boolean attribute of the canvas element, whose presence indicates that the alpha values in the canvas backing store must be 1.0 at al...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Description:&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;opaque&amp;quot; attribute is a boolean attribute of the canvas element, whose presence indicates that the alpha values in the canvas backing store must be 1.0 at all times.  All canvas operations are modified to preserve this invariant.  If the &amp;quot;opaque&amp;quot; attribute is not present, or if parsing its value returns an error, then the default value (false) must be used instead.&lt;br /&gt;
&lt;br /&gt;
When a canvas has the opaque attribute, the backing store must be initialized to opaque black (rgba(0, 0, 0, 1.0)), instead of transparent black (rgba(0, 0, 0, 0.0)).  Setting, changing, removing or setting the attribute redundantly to its existing value causes the canvas to be cleared to the appropriate value.&lt;br /&gt;
&lt;br /&gt;
When a canvas has the opaque attribute, clearRect() clears to opaque black instead of transparent black.&lt;br /&gt;
&lt;br /&gt;
The behaviour of putImageData() and putImageDataHD() when a canvas has the opaque attribute is to premultiply the RGB components by the alpha component as usual, but write 1.0 into destination alpha.  In other words, if (r, g, b, a) are the component values in a given pixel passed to putImageData[HD](), then r&#039; = ar, g&#039; = ag, b&#039; = ab are the colour components of the resulting canvas pixel, and (r&#039;, g&#039;, b&#039;, 1.0) is written to the canvas backing store.&lt;br /&gt;
&lt;br /&gt;
When a canvas has the opaque attribute, all globalCompositeOperation modes behave as normal and the resulting RGB components are written to the canvas backing store, but the alpha component is left unchanged at 1.0.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;This proposal is allowing the specification of an opaque backing store for 2D Canvas, to optimize blending and culling.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Use case: A 2D UI is written using canvas which is attempting to achieve top performance.  It clears its backing store to opaque, and only uses non-alpha-modifying canvas commands, but since the user agent cannot determine this empirically from an arbitrary set of canvas commands, it cannot optimize the blending and culling of obscured elements when compositing the canvas into the page.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
Many sites already draw only opaque canvases, but have no way to convey this to the user agent.  Using WebGL might be a (rather heavy-handed) workaround in some cases, since WebGL already provides this API.&lt;br /&gt;
&lt;br /&gt;
Compositing a &amp;lt;canvas&amp;gt; element into the page can be expensive, due to blending operations, and lack of opportunity for culling.  Since arbitrary graphics operations can affect the opacity of the canvas, it is difficult to determine programmatically whether the canvas is opaque.  Allowing the developer to explicitly mark a canvas as opaque allows the user agent to optimize blending at page composite time, as well to cull fully-obscured elements behind the canvas.&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
# Allow the specification of an opaque backing store at getContext() time.&lt;br /&gt;
# Allow the user agent to easily optimize compositing and culling of the canvas.&lt;br /&gt;
&lt;br /&gt;
== Non Goals ==&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
One proposed solution was implemented by Mozilla as the &amp;lt;tt&amp;gt;mozOpaque&amp;gt; attribute on the &amp;lt;tt&amp;gt;canvas&amp;lt;/tt&amp;gt; element.  Semantically, this is exactly what we want.  However, it does not match WebGL semantics, which already has such an API.&lt;br /&gt;
&lt;br /&gt;
=== Suggested Solution ===&lt;br /&gt;
&lt;br /&gt;
Allow an optional parameter to the Canvas element&#039;s &amp;lt;tt&amp;gt;getContext&amp;lt;/tt&amp;gt; method, which can specify the &amp;quot;alpha&amp;quot; context creation parameter:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    var ctx = canvas.getContext(&#039;2d&#039;, { alpha: false });&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Suggested IDL ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
interface Canvas2DContextAttributes {&lt;br /&gt;
    attribute boolean alpha;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
interface Canvas2DRenderingContext {&lt;br /&gt;
    ...&lt;br /&gt;
    Canvas2DContextAttributes getContextAttributes();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Rationale: ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why not add a new element attribute instead?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Implementing the same syntax as WebGL brings consistency to the web platform, obeys the principle of least surprise for developers.  It also may allow more code sharing in JavaScript, since with duck typing, the same object can be used for both.&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Can you call getContext more than once on the same canvas, with different values for { alpha }?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; No.  Once it has been called once, the type of the backing store is set.  Calling it again with a different argument raises an exception.&lt;br /&gt;
== Issues: ==&lt;br /&gt;
&lt;br /&gt;
=== Implementing non-alpha-modifying compositing modes may be difficult in some 2D graphics APIs ===&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>StephenWhite</name></author>
	</entry>
</feed>