[html5] r8755 - [giow] (1) Define getContext('2d', {alpha:false}). Fixing https://www.w3.org/Bug [...]
whatwg at whatwg.org
whatwg at whatwg.org
Mon Sep 8 15:53:15 PDT 2014
Author: ianh
Date: 2014-09-08 15:53:10 -0700 (Mon, 08 Sep 2014)
New Revision: 8755
Modified:
complete.html
index
source
Log:
[giow] (1) Define getContext('2d', {alpha:false}).
Fixing https://www.w3.org/Bugs/Public/show_bug.cgi?id=23515
Affected topics: Canvas, DOM APIs
Modified: complete.html
===================================================================
--- complete.html 2014-09-08 21:47:40 UTC (rev 8754)
+++ complete.html 2014-09-08 22:53:10 UTC (rev 8755)
@@ -2270,6 +2270,7 @@
<li><dfn id=dfn-read-only-array>Read only</dfn> (when applied to arrays)
<li><dfn id=dfn-callback-this-value>Callback this value</dfn>
<li><dfn id=convert-a-domstring-to-a-sequence-of-unicode-characters>Convert a <code>DOMString</code> to a sequence of Unicode characters</dfn>
+ <li><dfn id=concept-idl-convert><a href=http://heycam.github.io/webidl/#es-type-mapping>Converting</a></dfn> between WebIDL types and JS types
</ul>
<p>The Web IDL specification also defines the following types that are used in Web IDL fragments
@@ -45730,16 +45731,20 @@
<th><a href=#concept-canvas-proxied id=the-canvas-element:concept-canvas-proxied>proxied</a>
<tbody><tr><th>"<dfn id=canvas-context-2d><code>2d</code></dfn>"
<td>
- Set the <code id=the-canvas-element:the-canvas-element-36><a href=#the-canvas-element>canvas</a></code> element's <a href=#concept-canvas-context-mode id=the-canvas-element:concept-canvas-context-mode-4>context
- mode</a> to <a href=#concept-canvas-direct-2d id=the-canvas-element:concept-canvas-direct-2d-3>direct-2d</a>; follow the <a href=#2d-context-creation-algorithm id=the-canvas-element:2d-context-creation-algorithm>2D
+
+ Follow the <a href=#2d-context-creation-algorithm id=the-canvas-element:2d-context-creation-algorithm>2D
context creation algorithm</a> defined in the section below, passing it the
- <code id=the-canvas-element:the-canvas-element-37><a href=#the-canvas-element>canvas</a></code> element, to obtain a <code id=the-canvas-element:canvasrenderingcontext2d-4><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object; set
- that object's <a href=#concept-canvas-context-bitmap-mode id=the-canvas-element:concept-canvas-context-bitmap-mode>context bitmap mode</a> to
+ <code id=the-canvas-element:the-canvas-element-36><a href=#the-canvas-element>canvas</a></code> element and the method's <var>arguments...</var>, to obtain a <code id=the-canvas-element:canvasrenderingcontext2d-4><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object;
+ if this does not throw an exception, then
+ set the <code id=the-canvas-element:the-canvas-element-37><a href=#the-canvas-element>canvas</a></code> element's <a href=#concept-canvas-context-mode id=the-canvas-element:concept-canvas-context-mode-4>context
+ mode</a> to <a href=#concept-canvas-direct-2d id=the-canvas-element:concept-canvas-direct-2d-3>direct-2d</a>, set
+ the <code id=the-canvas-element:canvasrenderingcontext2d-5><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#concept-canvas-context-bitmap-mode id=the-canvas-element:concept-canvas-context-bitmap-mode>context bitmap mode</a> to
<a href=#concept-canvas-fixed id=the-canvas-element:concept-canvas-fixed>fixed</a>, and return the
- <code id=the-canvas-element:canvasrenderingcontext2d-5><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object
+ <code id=the-canvas-element:canvasrenderingcontext2d-6><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object
+
<td>
Return the same object as was return the last time the method was invoked with this same
- argument.
+ first argument.
<td>
Return null.
<td>
@@ -45749,16 +45754,18 @@
<tr><th>"<dfn id=canvas-context-webgl><code>webgl</code></dfn>", if the user agent supports the WebGL feature in its current configuration
<td>
+
Follow the instructions given in the WebGL specification's <i>Context Creation</i> section to
obtain either a <code id=the-canvas-element:webglrenderingcontext-2><a href=#webglrenderingcontext>WebGLRenderingContext</a></code> or null; if the returned value is null,
then return null and abort these steps, otherwise, set the <code id=the-canvas-element:the-canvas-element-38><a href=#the-canvas-element>canvas</a></code> element's <a href=#concept-canvas-context-mode id=the-canvas-element:concept-canvas-context-mode-5>context mode</a> to <a href=#concept-canvas-direct-webgl id=the-canvas-element:concept-canvas-direct-webgl-2>direct-webgl</a>, set the new
<code id=the-canvas-element:webglrenderingcontext-3><a href=#webglrenderingcontext>WebGLRenderingContext</a></code> object's <a href=#concept-canvas-context-bitmap-mode id=the-canvas-element:concept-canvas-context-bitmap-mode-2>context bitmap mode</a> to <a href=#concept-canvas-fixed id=the-canvas-element:concept-canvas-fixed-2>fixed</a>, and return the <code id=the-canvas-element:webglrenderingcontext-4><a href=#webglrenderingcontext>WebGLRenderingContext</a></code>
- object‡ <a href=#refsWEBGL>[WEBGL]</a>
+ object <a href=#refsWEBGL>[WEBGL]</a>
+
<td>
Return null.
<td>
Return the same object as was return the last time the method was invoked with this same
- argument.
+ first argument.
<td>
Throw an <code id=the-canvas-element:invalidstateerror-7><a href=#invalidstateerror>InvalidStateError</a></code> exception.
<td>
@@ -45795,10 +45802,6 @@
<p class=tablenote><small>† For example, the "<code id=the-canvas-element:canvas-context-webgl-4><a href=#canvas-context-webgl>webgl</a></code>" value in the case of a user agent having exhausted the
graphics hardware's abilities and having no software fallback implementation.</small></p>
- <p class=tablenote><small>‡ The second (and subsequent) argument(s) to the method, if
- any, are ignored in all cases except this one. See the WebGL specification for
- details.</small></p>
-
<hr>
<p>The <dfn id=dom-canvas-probablysupportscontext><code>probablySupportsContext(<var>contextId</var>,
@@ -46014,6 +46017,10 @@
enum <dfn id=canvasfillrule>CanvasFillRule</dfn> { "<a href=#dom-context-2d-fillrule-nonzero id=2dcontext:dom-context-2d-fillrule-nonzero>nonzero</a>", "<a href=#dom-context-2d-fillrule-evenodd id=2dcontext:dom-context-2d-fillrule-evenodd>evenodd</a>" };
+dictionary <dfn id=canvasrenderingcontext2dsettings>CanvasRenderingContext2DSettings</dfn> {
+ boolean <a href=#dom-canvasrenderingcontext2dsettings-alpha id=2dcontext:dom-canvasrenderingcontext2dsettings-alpha>alpha</a> = true;
+}
+
[<a href=#dom-context-2d id=2dcontext:dom-context-2d>Constructor</a>(optional unsigned long width, unsigned long height), Exposed=(Window,Worker)]
interface <dfn id=canvasrenderingcontext2d>CanvasRenderingContext2D</dfn> {
@@ -46218,11 +46225,14 @@
- <dl class=domintro><dt><var>context</var> = <var>canvas</var> . <code id=2dcontext:dom-canvas-getcontext><a href=#dom-canvas-getcontext>getContext</a></code>('2d')<dd>
+ <dl class=domintro><dt><var>context</var> = <var>canvas</var> . <code id=2dcontext:dom-canvas-getcontext><a href=#dom-canvas-getcontext>getContext</a></code>('2d' [, { [ <code id=2dcontext:dom-canvasrenderingcontext2dsettings-alpha-2><a href=#dom-canvasrenderingcontext2dsettings-alpha>alpha</a></code>: false ] } ] )<dd>
<p>Returns a <code id=2dcontext:canvasrenderingcontext2d-4><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object that is permanently bound to a
particular <code id=2dcontext:the-canvas-element><a href=#the-canvas-element>canvas</a></code> element.</p>
+ <p>If the <code id=2dcontext:dom-canvasrenderingcontext2dsettings-alpha-3><a href=#dom-canvasrenderingcontext2dsettings-alpha>alpha</a></code> setting is
+ provided and set to false, then the canvas is forced to always be opaque.</p>
+
<dt><var>context</var> = new <code id=2dcontext:dom-context-2d-2><a href=#dom-context-2d>CanvasRenderingContext2D</a></code>( [ <var>width</var>, <var>height</var> ] )<dd>
<p>Returns an unbound <code id=2dcontext:canvasrenderingcontext2d-5><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object with an implied bitmap with
@@ -46264,18 +46274,37 @@
<p>These bitmaps also have a <a href=#hit-region-list id=2dcontext:hit-region-list>hit region list</a>, which is described in a later section.
- Initially, this list is empty. <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-2>Scratch bitmaps</a> also have a
+ Initially, this list is empty.</p>
+
+ <p><a href=#scratch-bitmap id=2dcontext:scratch-bitmap-2>Scratch bitmaps</a> have a
<dfn id=list-of-pending-interface-actions>list of pending interface actions</dfn>, which can contain instructions to draw the user's
attention to a location on the bitmap, and instructions to scroll to a location on the bitmap.
Initially, this list is also empty.</p>
+ <p><a href=#scratch-bitmap id=2dcontext:scratch-bitmap-3>Scratch bitmaps</a> also have an <dfn id=concept-canvas-alpha>alpha</dfn> flag, which can be set to true or false. Initially, when
+ one of these bitmaps is created, its <a href=#concept-canvas-alpha id=2dcontext:concept-canvas-alpha>alpha</a> flag must be
+ set to true. When a <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-4>scratch bitmap</a> has its <a href=#concept-canvas-alpha id=2dcontext:concept-canvas-alpha-2>alpha</a> flag set to false, then its alpha channel must be fixed
+ to 1.0 (fully opaque) for all pixels, and attempts to change the alpha component of any pixel must
+ be silently ignored.</p>
+
+ <p class=note>Thus, such a bitmap starts off as fully-opaque black instead of fully-tranparent
+ black; <code id=2dcontext:dom-context-2d-clearrect-2><a href=#dom-context-2d-clearrect>clearRect()</a></code> always results in fully-opaque
+ black pixels, every fourth byte from <code id=2dcontext:dom-context-2d-getimagedata-2><a href=#dom-context-2d-getimagedata>getImageData()</a></code> is always 255, the <code id=2dcontext:dom-context-2d-putimagedata-3><a href=#dom-context-2d-putimagedata>putImageData()</a></code> method effectively ignores every fourth
+ byte in its input, and so on. However, the alpha component of styles and images drawn onto the
+ canvas are still honoured up to the point where they would impact the <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-5>scratch
+ bitmap</a>'s alpha channel; for instance, drawing a 50% transparent white square on a freshly
+ created <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-6>scratch bitmap</a> with its <a href=#concept-canvas-alpha id=2dcontext:concept-canvas-alpha-3>alpha</a> flag
+ set to false will result in a fully-opaque gray square.</p>
+
+ <hr>
+
<p>The <code id=2dcontext:canvasrenderingcontext2d-8><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> 2D rendering context represents a flat linear
Cartesian surface whose origin (0,0) is at the top left corner, with the coordinate space having
<var>x</var> values increasing when going right, and <var>y</var> values
increasing when going down. The <var>x</var>-coordinate of the right-most edge is equal to
- the width of the rendering context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-3>scratch bitmap</a> in CSS pixels; similarly, the
+ the width of the rendering context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-7>scratch bitmap</a> in CSS pixels; similarly, the
<var>y</var>-coordinate of the bottom-most edge is equal to the height of the rendering
- context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-4>scratch bitmap</a> in CSS pixels.</p>
+ context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-8>scratch bitmap</a> in CSS pixels.</p>
<p>The size of the coordinate space does not necessarily represent the size of the actual bitmaps
that the user agent will use internally or during rendering. On high-definition displays, for
@@ -46287,36 +46316,54 @@
<hr>
<p>The <dfn id=2d-context-creation-algorithm>2D context creation algorithm</dfn>, which is passed a <var>target</var> (a
- <code id=2dcontext:the-canvas-element-5><a href=#the-canvas-element>canvas</a></code> element), consists of running the following steps:</p>
+ <code id=2dcontext:the-canvas-element-5><a href=#the-canvas-element>canvas</a></code> element) and optionally some arguments, consists of running the following steps:</p>
- <ol><li><p>Create a new <code id=2dcontext:canvasrenderingcontext2d-9><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object.<li><p>Initialise its <code id=2dcontext:dom-context-2d-canvas-3><a href=#dom-context-2d-canvas>canvas</a></code> attribute to point to
+ <ol><li><p>If the algorithm was passed some arguments, let <var>arg</var> be the first such argument.
+ Otherwise, let <var>arg</var> be <i>undefined</i>.<li><p>Let <var>settings</var> be the result of <a href=#coerce-context-arguments-for-2d id=2dcontext:coerce-context-arguments-for-2d>coercing the <var>arg</var> context arguments for 2D</a>.<li><p>Create a new <code id=2dcontext:canvasrenderingcontext2d-9><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object.<li><p>Initialise its <code id=2dcontext:dom-context-2d-canvas-3><a href=#dom-context-2d-canvas>canvas</a></code> attribute to point to
<var>target</var>.<li><p>Let the new <code id=2dcontext:canvasrenderingcontext2d-10><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#output-bitmap id=2dcontext:output-bitmap-3>output bitmap</a> and
- <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-5>scratch bitmap</a> both be the same bitmap as <var>target</var>'s bitmap (so
+ <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-9>scratch bitmap</a> both be the same bitmap as <var>target</var>'s bitmap (so
that they are shared).<li><p><a href=#concept-canvas-set-bitmap-dimensions id=2dcontext:concept-canvas-set-bitmap-dimensions>Set bitmap dimensions</a> to the
numeric values of <var>target</var>'s <code id=2dcontext:attr-canvas-width><a href=#attr-canvas-width>width</a></code> and
- <code id=2dcontext:attr-canvas-height><a href=#attr-canvas-height>height</a></code> content attributes.<li><p>Return the new <code id=2dcontext:canvasrenderingcontext2d-11><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object.</ol>
+ <code id=2dcontext:attr-canvas-height><a href=#attr-canvas-height>height</a></code> content attributes.<li>
+ <p>Process each of the members of <var>settings</var> as follows:</p>
+
+ <dl><dt><dfn id=dom-canvasrenderingcontext2dsettings-alpha><code>alpha</code></dfn><dd>If false, then set the <var>target</var>'s bitmap's <a href=#concept-canvas-alpha id=2dcontext:concept-canvas-alpha-4>alpha</a> flag to false.</dl>
+
+ <li><p>Return the new <code id=2dcontext:canvasrenderingcontext2d-11><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object.</ol>
+
<hr>
<p>The <dfn id=dom-context-2d><code>CanvasRenderingContext2D()</code></dfn> constructor, when
invoked, must run the following steps:</p>
<ol><li><p>Create a new <code id=2dcontext:canvasrenderingcontext2d-12><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object.<li><p>Initialise its <code id=2dcontext:dom-context-2d-canvas-4><a href=#dom-context-2d-canvas>canvas</a></code> attribute to
- null.<li><p>Let the new <code id=2dcontext:canvasrenderingcontext2d-13><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-6>scratch bitmap</a> be
+ null.<li><p>Let the new <code id=2dcontext:canvasrenderingcontext2d-13><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-10>scratch bitmap</a> be
a new bitmap.<li><p>If the constructor was called with arguments, let <var>width</var> and <var>height</var> be the first and second arguments, respectively. Otherwise, let <var>width</var> and <var>height</var> be 300 and 150, respectively.<li><p><a href=#concept-canvas-set-bitmap-dimensions id=2dcontext:concept-canvas-set-bitmap-dimensions-2>Set bitmap dimensions</a> to <var>width</var> and <var>height</var>.<li><p>Let the new <code id=2dcontext:canvasrenderingcontext2d-14><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object have no <a href=#output-bitmap id=2dcontext:output-bitmap-4>output
bitmap</a>.<li><p>Return the new <code id=2dcontext:canvasrenderingcontext2d-15><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object.</ol>
<hr>
+ <p>When a user agent is required to <dfn id=coerce-context-arguments-for-2d>coerce context arguments for 2D</dfn>, it must run the
+ following steps:</p>
+
+ <ol><li><p>Let <var>input</var> be the argument to coerce.<li><p>Let <var>jsval</var> be the result of <a href=http://heycam.github.io/webidl/#es-type-mapping id=2dcontext:concept-idl-convert data-x-internal=concept-idl-convert>converting</a>
+ <var>input</var> to an ECMAScript value. If this throws an exception, then propagate the
+ exception and abort these steps.<li><p>Let <var>dict</var> be the result of <a href=http://heycam.github.io/webidl/#es-type-mapping id=2dcontext:concept-idl-convert-2 data-x-internal=concept-idl-convert>converting</a>
+ <var>jsval</var> to the dictionary type <code id=2dcontext:canvasrenderingcontext2dsettings><a href=#canvasrenderingcontext2dsettings>CanvasRenderingContext2DSettings</a></code>. If this
+ throws an exception, then propagate the exception and abort these steps.<li><p>Return <var>dict</var>.</ol>
+
+ <hr>
+
<p>When the user agent is required to <dfn id=commit-the-scratch-bitmap>commit the scratch bitmap</dfn> for a rendering
context, it must run the following steps:
- <ol><li><p>Let <var>bitmap copy</var> be a copy of the rendering context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-7>scratch
+ <ol><li><p>Let <var>bitmap copy</var> be a copy of the rendering context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-11>scratch
bitmap</a>.<li><p>Let <var>origin-clean flag copy</var> be a copy of the rendering context's
- <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-8>scratch bitmap</a>'s <a href=#concept-canvas-origin-clean id=2dcontext:concept-canvas-origin-clean-3>origin-clean</a>
+ <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-12>scratch bitmap</a>'s <a href=#concept-canvas-origin-clean id=2dcontext:concept-canvas-origin-clean-3>origin-clean</a>
flag.<li><p>Let <var>hit region list copy</var> be a copy of the rendering context's
- <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-9>scratch bitmap</a>'s <a href=#hit-region-list id=2dcontext:hit-region-list-2>hit region list</a>.<li><p>Let <var>list of pending interface actions copy</var> be a copy of the rendering
- context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-10>scratch bitmap</a>'s <a href=#list-of-pending-interface-actions id=2dcontext:list-of-pending-interface-actions>list of pending interface actions</a>.<li><p>Empty the <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-11>scratch bitmap</a>'s <a href=#list-of-pending-interface-actions id=2dcontext:list-of-pending-interface-actions-2>list of pending interface actions</a>.<li><p>If the rendering context has no <a href=#output-bitmap id=2dcontext:output-bitmap-5>output bitmap</a>, abort these steps.<li><p>Let <var>output bitmap</var> be the rendering context's <a href=#output-bitmap id=2dcontext:output-bitmap-6>output
+ <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-13>scratch bitmap</a>'s <a href=#hit-region-list id=2dcontext:hit-region-list-2>hit region list</a>.<li><p>Let <var>list of pending interface actions copy</var> be a copy of the rendering
+ context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-14>scratch bitmap</a>'s <a href=#list-of-pending-interface-actions id=2dcontext:list-of-pending-interface-actions>list of pending interface actions</a>.<li><p>Empty the <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-15>scratch bitmap</a>'s <a href=#list-of-pending-interface-actions id=2dcontext:list-of-pending-interface-actions-2>list of pending interface actions</a>.<li><p>If the rendering context has no <a href=#output-bitmap id=2dcontext:output-bitmap-5>output bitmap</a>, abort these steps.<li><p>Let <var>output bitmap</var> be the rendering context's <a href=#output-bitmap id=2dcontext:output-bitmap-6>output
bitmap</a>.<li><p>Let <var>canvas</var> be the <code id=2dcontext:the-canvas-element-6><a href=#the-canvas-element>canvas</a></code> element to which the rendering
context was most recently <a href=#concept-canvas-binding-steps id=2dcontext:concept-canvas-binding-steps-2>bound</a>.<li>
@@ -46342,8 +46389,8 @@
mode</a> is <a href=#concept-canvas-bound id=2dcontext:concept-canvas-bound>fixed</a>, throw an
<code id=2dcontext:invalidstateerror><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these steps.<li><p><a href=#commit-the-scratch-bitmap id=2dcontext:commit-the-scratch-bitmap>Commit the scratch bitmap</a> for the rendering context.</ol>
- <p class=note>The <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-12>scratch bitmap</a> is only <a href=#commit-the-scratch-bitmap id=2dcontext:commit-the-scratch-bitmap-2>committed</a> when the <code id=2dcontext:dom-context-2d-commit-3><a href=#dom-context-2d-commit>commit()</a></code> method is
- called. (This doesn't matter for <code id=2dcontext:the-canvas-element-7><a href=#the-canvas-element>canvas</a></code> elements in <a href=#concept-canvas-direct-2d id=2dcontext:concept-canvas-direct-2d>direct-2d</a> mode, since there the <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-13>scratch
+ <p class=note>The <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-16>scratch bitmap</a> is only <a href=#commit-the-scratch-bitmap id=2dcontext:commit-the-scratch-bitmap-2>committed</a> when the <code id=2dcontext:dom-context-2d-commit-3><a href=#dom-context-2d-commit>commit()</a></code> method is
+ called. (This doesn't matter for <code id=2dcontext:the-canvas-element-7><a href=#the-canvas-element>canvas</a></code> elements in <a href=#concept-canvas-direct-2d id=2dcontext:concept-canvas-direct-2d>direct-2d</a> mode, since there the <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-17>scratch
bitmap</a> is also the <code id=2dcontext:the-canvas-element-8><a href=#the-canvas-element>canvas</a></code> element's bitmap so every drawing operation is
immediately drawn.)</p>
@@ -46353,8 +46400,8 @@
dimensions</dfn> to <var>width</var> and <var>height</var>, it must run the
following steps:</p>
- <ol><li><p><a href=#reset-the-rendering-context-to-its-default-state id=2dcontext:reset-the-rendering-context-to-its-default-state>Reset the rendering context to its default state</a>.<li><p>Clear the <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-14>scratch bitmap</a>'s <a href=#hit-region-list id=2dcontext:hit-region-list-4>hit region list</a> and its <a href=#list-of-pending-interface-actions id=2dcontext:list-of-pending-interface-actions-3>list of
- pending interface actions</a>.<li><p>Resize the <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-15>scratch bitmap</a> to the new <var>width</var> and <var>height</var> and clear it to fully transparent black.<li><p>If the rendering context has an <a href=#output-bitmap id=2dcontext:output-bitmap-7>output bitmap</a>, and the <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-16>scratch
+ <ol><li><p><a href=#reset-the-rendering-context-to-its-default-state id=2dcontext:reset-the-rendering-context-to-its-default-state>Reset the rendering context to its default state</a>.<li><p>Clear the <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-18>scratch bitmap</a>'s <a href=#hit-region-list id=2dcontext:hit-region-list-4>hit region list</a> and its <a href=#list-of-pending-interface-actions id=2dcontext:list-of-pending-interface-actions-3>list of
+ pending interface actions</a>.<li><p>Resize the <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-19>scratch bitmap</a> to the new <var>width</var> and <var>height</var> and clear it to fully transparent black.<li><p>If the rendering context has an <a href=#output-bitmap id=2dcontext:output-bitmap-7>output bitmap</a>, and the <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-20>scratch
bitmap</a> is a different bitmap than the <a href=#output-bitmap id=2dcontext:output-bitmap-8>output bitmap</a>, then resize the
<a href=#output-bitmap id=2dcontext:output-bitmap-9>output bitmap</a> to the new <var>width</var> and <var>height</var>
and clear it to fully transparent black.<li>
@@ -46391,19 +46438,19 @@
<p>When the user agent is to run the <dfn id=concept-canvas-unbinding-steps>unbinding
steps</dfn> for a rendering context, it must run the following steps:</p>
- <ol><li><p><a href=#reset-the-rendering-context-to-its-default-state id=2dcontext:reset-the-rendering-context-to-its-default-state-2>Reset the rendering context to its default state</a>.<li><p>Clear the <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-17>scratch bitmap</a>'s <a href=#hit-region-list id=2dcontext:hit-region-list-5>hit region list</a> and its <a href=#list-of-pending-interface-actions id=2dcontext:list-of-pending-interface-actions-4>list of
- pending interface actions</a>.<li><p>Clear the <code id=2dcontext:canvasrenderingcontext2d-16><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-18>scratch bitmap</a> to a
- transparent black.<li><p>Set the <code id=2dcontext:canvasrenderingcontext2d-17><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-19>scratch bitmap</a>'s <a href=#concept-canvas-origin-clean id=2dcontext:concept-canvas-origin-clean-5>origin-clean</a> flag to true.<li><p>Let the <code id=2dcontext:canvasrenderingcontext2d-18><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object have no <a href=#output-bitmap id=2dcontext:output-bitmap-10>output
+ <ol><li><p><a href=#reset-the-rendering-context-to-its-default-state id=2dcontext:reset-the-rendering-context-to-its-default-state-2>Reset the rendering context to its default state</a>.<li><p>Clear the <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-21>scratch bitmap</a>'s <a href=#hit-region-list id=2dcontext:hit-region-list-5>hit region list</a> and its <a href=#list-of-pending-interface-actions id=2dcontext:list-of-pending-interface-actions-4>list of
+ pending interface actions</a>.<li><p>Clear the <code id=2dcontext:canvasrenderingcontext2d-16><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-22>scratch bitmap</a> to a
+ transparent black.<li><p>Set the <code id=2dcontext:canvasrenderingcontext2d-17><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-23>scratch bitmap</a>'s <a href=#concept-canvas-origin-clean id=2dcontext:concept-canvas-origin-clean-5>origin-clean</a> flag to true.<li><p>Let the <code id=2dcontext:canvasrenderingcontext2d-18><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object have no <a href=#output-bitmap id=2dcontext:output-bitmap-10>output
bitmap</a>.</ol>
<p>When the user agent is to run the <dfn id=concept-canvas-binding-steps>binding steps</dfn>
to bind the rendering context to the <code id=2dcontext:the-canvas-element-10><a href=#the-canvas-element>canvas</a></code> element <var>target</var>, it
must run the following steps:</p>
- <ol><li><p><a href=#reset-the-rendering-context-to-its-default-state id=2dcontext:reset-the-rendering-context-to-its-default-state-3>Reset the rendering context to its default state</a>.<li><p>Clear the <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-20>scratch bitmap</a>'s <a href=#hit-region-list id=2dcontext:hit-region-list-6>hit region list</a> and its <a href=#list-of-pending-interface-actions id=2dcontext:list-of-pending-interface-actions-5>list of
- pending interface actions</a>.<li><p>Resize the <code id=2dcontext:canvasrenderingcontext2d-19><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-21>scratch bitmap</a> to
+ <ol><li><p><a href=#reset-the-rendering-context-to-its-default-state id=2dcontext:reset-the-rendering-context-to-its-default-state-3>Reset the rendering context to its default state</a>.<li><p>Clear the <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-24>scratch bitmap</a>'s <a href=#hit-region-list id=2dcontext:hit-region-list-6>hit region list</a> and its <a href=#list-of-pending-interface-actions id=2dcontext:list-of-pending-interface-actions-5>list of
+ pending interface actions</a>.<li><p>Resize the <code id=2dcontext:canvasrenderingcontext2d-19><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-25>scratch bitmap</a> to
the dimensions of <var>target</var>'s bitmap and clear it to fully transparent
- black.<li><p>Set the <code id=2dcontext:canvasrenderingcontext2d-20><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-22>scratch bitmap</a>'s <a href=#concept-canvas-origin-clean id=2dcontext:concept-canvas-origin-clean-6>origin-clean</a> flag to true.<li><p>Let the <code id=2dcontext:canvasrenderingcontext2d-21><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#output-bitmap id=2dcontext:output-bitmap-11>output bitmap</a> be <var>target</var>'s bitmap.</ol>
+ black.<li><p>Set the <code id=2dcontext:canvasrenderingcontext2d-20><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-26>scratch bitmap</a>'s <a href=#concept-canvas-origin-clean id=2dcontext:concept-canvas-origin-clean-6>origin-clean</a> flag to true.<li><p>Let the <code id=2dcontext:canvasrenderingcontext2d-21><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#output-bitmap id=2dcontext:output-bitmap-11>output bitmap</a> be <var>target</var>'s bitmap.</ol>
<hr>
@@ -46411,15 +46458,15 @@
value it was initialised to when the object was created.</p>
<p>The <dfn id=dom-context-2d-width><code>width</code></dfn> attribute, on getting, must
- return the width of the rendering context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-23>scratch bitmap</a>, in CSS pixels. On
+ return the width of the rendering context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-27>scratch bitmap</a>, in CSS pixels. On
setting, it must <a href=#concept-canvas-set-bitmap-dimensions id=2dcontext:concept-canvas-set-bitmap-dimensions-3>set bitmap dimensions</a>
- to the new value and the current height of the rendering context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-24>scratch bitmap</a> in
+ to the new value and the current height of the rendering context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-28>scratch bitmap</a> in
CSS pixels, respectively.</p>
<p>The <dfn id=dom-context-2d-height><code>height</code></dfn> attribute, on getting, must
- return the height of the rendering context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-25>scratch bitmap</a>, in CSS pixels. On
+ return the height of the rendering context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-29>scratch bitmap</a>, in CSS pixels. On
setting, it must <a href=#concept-canvas-set-bitmap-dimensions id=2dcontext:concept-canvas-set-bitmap-dimensions-4>set bitmap dimensions</a>
- to the current width of the rendering context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-26>scratch bitmap</a> in CSS pixels and the
+ to the current width of the rendering context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-30>scratch bitmap</a> in CSS pixels and the
new value, respectively.</p>
<hr>
Modified: index
===================================================================
--- index 2014-09-08 21:47:40 UTC (rev 8754)
+++ index 2014-09-08 22:53:10 UTC (rev 8755)
@@ -2270,6 +2270,7 @@
<li><dfn id=dfn-read-only-array>Read only</dfn> (when applied to arrays)
<li><dfn id=dfn-callback-this-value>Callback this value</dfn>
<li><dfn id=convert-a-domstring-to-a-sequence-of-unicode-characters>Convert a <code>DOMString</code> to a sequence of Unicode characters</dfn>
+ <li><dfn id=concept-idl-convert><a href=http://heycam.github.io/webidl/#es-type-mapping>Converting</a></dfn> between WebIDL types and JS types
</ul>
<p>The Web IDL specification also defines the following types that are used in Web IDL fragments
@@ -45730,16 +45731,20 @@
<th><a href=#concept-canvas-proxied id=the-canvas-element:concept-canvas-proxied>proxied</a>
<tbody><tr><th>"<dfn id=canvas-context-2d><code>2d</code></dfn>"
<td>
- Set the <code id=the-canvas-element:the-canvas-element-36><a href=#the-canvas-element>canvas</a></code> element's <a href=#concept-canvas-context-mode id=the-canvas-element:concept-canvas-context-mode-4>context
- mode</a> to <a href=#concept-canvas-direct-2d id=the-canvas-element:concept-canvas-direct-2d-3>direct-2d</a>; follow the <a href=#2d-context-creation-algorithm id=the-canvas-element:2d-context-creation-algorithm>2D
+
+ Follow the <a href=#2d-context-creation-algorithm id=the-canvas-element:2d-context-creation-algorithm>2D
context creation algorithm</a> defined in the section below, passing it the
- <code id=the-canvas-element:the-canvas-element-37><a href=#the-canvas-element>canvas</a></code> element, to obtain a <code id=the-canvas-element:canvasrenderingcontext2d-4><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object; set
- that object's <a href=#concept-canvas-context-bitmap-mode id=the-canvas-element:concept-canvas-context-bitmap-mode>context bitmap mode</a> to
+ <code id=the-canvas-element:the-canvas-element-36><a href=#the-canvas-element>canvas</a></code> element and the method's <var>arguments...</var>, to obtain a <code id=the-canvas-element:canvasrenderingcontext2d-4><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object;
+ if this does not throw an exception, then
+ set the <code id=the-canvas-element:the-canvas-element-37><a href=#the-canvas-element>canvas</a></code> element's <a href=#concept-canvas-context-mode id=the-canvas-element:concept-canvas-context-mode-4>context
+ mode</a> to <a href=#concept-canvas-direct-2d id=the-canvas-element:concept-canvas-direct-2d-3>direct-2d</a>, set
+ the <code id=the-canvas-element:canvasrenderingcontext2d-5><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#concept-canvas-context-bitmap-mode id=the-canvas-element:concept-canvas-context-bitmap-mode>context bitmap mode</a> to
<a href=#concept-canvas-fixed id=the-canvas-element:concept-canvas-fixed>fixed</a>, and return the
- <code id=the-canvas-element:canvasrenderingcontext2d-5><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object
+ <code id=the-canvas-element:canvasrenderingcontext2d-6><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object
+
<td>
Return the same object as was return the last time the method was invoked with this same
- argument.
+ first argument.
<td>
Return null.
<td>
@@ -45749,16 +45754,18 @@
<tr><th>"<dfn id=canvas-context-webgl><code>webgl</code></dfn>", if the user agent supports the WebGL feature in its current configuration
<td>
+
Follow the instructions given in the WebGL specification's <i>Context Creation</i> section to
obtain either a <code id=the-canvas-element:webglrenderingcontext-2><a href=#webglrenderingcontext>WebGLRenderingContext</a></code> or null; if the returned value is null,
then return null and abort these steps, otherwise, set the <code id=the-canvas-element:the-canvas-element-38><a href=#the-canvas-element>canvas</a></code> element's <a href=#concept-canvas-context-mode id=the-canvas-element:concept-canvas-context-mode-5>context mode</a> to <a href=#concept-canvas-direct-webgl id=the-canvas-element:concept-canvas-direct-webgl-2>direct-webgl</a>, set the new
<code id=the-canvas-element:webglrenderingcontext-3><a href=#webglrenderingcontext>WebGLRenderingContext</a></code> object's <a href=#concept-canvas-context-bitmap-mode id=the-canvas-element:concept-canvas-context-bitmap-mode-2>context bitmap mode</a> to <a href=#concept-canvas-fixed id=the-canvas-element:concept-canvas-fixed-2>fixed</a>, and return the <code id=the-canvas-element:webglrenderingcontext-4><a href=#webglrenderingcontext>WebGLRenderingContext</a></code>
- object‡ <a href=#refsWEBGL>[WEBGL]</a>
+ object <a href=#refsWEBGL>[WEBGL]</a>
+
<td>
Return null.
<td>
Return the same object as was return the last time the method was invoked with this same
- argument.
+ first argument.
<td>
Throw an <code id=the-canvas-element:invalidstateerror-7><a href=#invalidstateerror>InvalidStateError</a></code> exception.
<td>
@@ -45795,10 +45802,6 @@
<p class=tablenote><small>† For example, the "<code id=the-canvas-element:canvas-context-webgl-4><a href=#canvas-context-webgl>webgl</a></code>" value in the case of a user agent having exhausted the
graphics hardware's abilities and having no software fallback implementation.</small></p>
- <p class=tablenote><small>‡ The second (and subsequent) argument(s) to the method, if
- any, are ignored in all cases except this one. See the WebGL specification for
- details.</small></p>
-
<hr>
<p>The <dfn id=dom-canvas-probablysupportscontext><code>probablySupportsContext(<var>contextId</var>,
@@ -46014,6 +46017,10 @@
enum <dfn id=canvasfillrule>CanvasFillRule</dfn> { "<a href=#dom-context-2d-fillrule-nonzero id=2dcontext:dom-context-2d-fillrule-nonzero>nonzero</a>", "<a href=#dom-context-2d-fillrule-evenodd id=2dcontext:dom-context-2d-fillrule-evenodd>evenodd</a>" };
+dictionary <dfn id=canvasrenderingcontext2dsettings>CanvasRenderingContext2DSettings</dfn> {
+ boolean <a href=#dom-canvasrenderingcontext2dsettings-alpha id=2dcontext:dom-canvasrenderingcontext2dsettings-alpha>alpha</a> = true;
+}
+
[<a href=#dom-context-2d id=2dcontext:dom-context-2d>Constructor</a>(optional unsigned long width, unsigned long height), Exposed=(Window,Worker)]
interface <dfn id=canvasrenderingcontext2d>CanvasRenderingContext2D</dfn> {
@@ -46218,11 +46225,14 @@
- <dl class=domintro><dt><var>context</var> = <var>canvas</var> . <code id=2dcontext:dom-canvas-getcontext><a href=#dom-canvas-getcontext>getContext</a></code>('2d')<dd>
+ <dl class=domintro><dt><var>context</var> = <var>canvas</var> . <code id=2dcontext:dom-canvas-getcontext><a href=#dom-canvas-getcontext>getContext</a></code>('2d' [, { [ <code id=2dcontext:dom-canvasrenderingcontext2dsettings-alpha-2><a href=#dom-canvasrenderingcontext2dsettings-alpha>alpha</a></code>: false ] } ] )<dd>
<p>Returns a <code id=2dcontext:canvasrenderingcontext2d-4><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object that is permanently bound to a
particular <code id=2dcontext:the-canvas-element><a href=#the-canvas-element>canvas</a></code> element.</p>
+ <p>If the <code id=2dcontext:dom-canvasrenderingcontext2dsettings-alpha-3><a href=#dom-canvasrenderingcontext2dsettings-alpha>alpha</a></code> setting is
+ provided and set to false, then the canvas is forced to always be opaque.</p>
+
<dt><var>context</var> = new <code id=2dcontext:dom-context-2d-2><a href=#dom-context-2d>CanvasRenderingContext2D</a></code>( [ <var>width</var>, <var>height</var> ] )<dd>
<p>Returns an unbound <code id=2dcontext:canvasrenderingcontext2d-5><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object with an implied bitmap with
@@ -46264,18 +46274,37 @@
<p>These bitmaps also have a <a href=#hit-region-list id=2dcontext:hit-region-list>hit region list</a>, which is described in a later section.
- Initially, this list is empty. <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-2>Scratch bitmaps</a> also have a
+ Initially, this list is empty.</p>
+
+ <p><a href=#scratch-bitmap id=2dcontext:scratch-bitmap-2>Scratch bitmaps</a> have a
<dfn id=list-of-pending-interface-actions>list of pending interface actions</dfn>, which can contain instructions to draw the user's
attention to a location on the bitmap, and instructions to scroll to a location on the bitmap.
Initially, this list is also empty.</p>
+ <p><a href=#scratch-bitmap id=2dcontext:scratch-bitmap-3>Scratch bitmaps</a> also have an <dfn id=concept-canvas-alpha>alpha</dfn> flag, which can be set to true or false. Initially, when
+ one of these bitmaps is created, its <a href=#concept-canvas-alpha id=2dcontext:concept-canvas-alpha>alpha</a> flag must be
+ set to true. When a <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-4>scratch bitmap</a> has its <a href=#concept-canvas-alpha id=2dcontext:concept-canvas-alpha-2>alpha</a> flag set to false, then its alpha channel must be fixed
+ to 1.0 (fully opaque) for all pixels, and attempts to change the alpha component of any pixel must
+ be silently ignored.</p>
+
+ <p class=note>Thus, such a bitmap starts off as fully-opaque black instead of fully-tranparent
+ black; <code id=2dcontext:dom-context-2d-clearrect-2><a href=#dom-context-2d-clearrect>clearRect()</a></code> always results in fully-opaque
+ black pixels, every fourth byte from <code id=2dcontext:dom-context-2d-getimagedata-2><a href=#dom-context-2d-getimagedata>getImageData()</a></code> is always 255, the <code id=2dcontext:dom-context-2d-putimagedata-3><a href=#dom-context-2d-putimagedata>putImageData()</a></code> method effectively ignores every fourth
+ byte in its input, and so on. However, the alpha component of styles and images drawn onto the
+ canvas are still honoured up to the point where they would impact the <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-5>scratch
+ bitmap</a>'s alpha channel; for instance, drawing a 50% transparent white square on a freshly
+ created <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-6>scratch bitmap</a> with its <a href=#concept-canvas-alpha id=2dcontext:concept-canvas-alpha-3>alpha</a> flag
+ set to false will result in a fully-opaque gray square.</p>
+
+ <hr>
+
<p>The <code id=2dcontext:canvasrenderingcontext2d-8><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> 2D rendering context represents a flat linear
Cartesian surface whose origin (0,0) is at the top left corner, with the coordinate space having
<var>x</var> values increasing when going right, and <var>y</var> values
increasing when going down. The <var>x</var>-coordinate of the right-most edge is equal to
- the width of the rendering context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-3>scratch bitmap</a> in CSS pixels; similarly, the
+ the width of the rendering context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-7>scratch bitmap</a> in CSS pixels; similarly, the
<var>y</var>-coordinate of the bottom-most edge is equal to the height of the rendering
- context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-4>scratch bitmap</a> in CSS pixels.</p>
+ context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-8>scratch bitmap</a> in CSS pixels.</p>
<p>The size of the coordinate space does not necessarily represent the size of the actual bitmaps
that the user agent will use internally or during rendering. On high-definition displays, for
@@ -46287,36 +46316,54 @@
<hr>
<p>The <dfn id=2d-context-creation-algorithm>2D context creation algorithm</dfn>, which is passed a <var>target</var> (a
- <code id=2dcontext:the-canvas-element-5><a href=#the-canvas-element>canvas</a></code> element), consists of running the following steps:</p>
+ <code id=2dcontext:the-canvas-element-5><a href=#the-canvas-element>canvas</a></code> element) and optionally some arguments, consists of running the following steps:</p>
- <ol><li><p>Create a new <code id=2dcontext:canvasrenderingcontext2d-9><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object.<li><p>Initialise its <code id=2dcontext:dom-context-2d-canvas-3><a href=#dom-context-2d-canvas>canvas</a></code> attribute to point to
+ <ol><li><p>If the algorithm was passed some arguments, let <var>arg</var> be the first such argument.
+ Otherwise, let <var>arg</var> be <i>undefined</i>.<li><p>Let <var>settings</var> be the result of <a href=#coerce-context-arguments-for-2d id=2dcontext:coerce-context-arguments-for-2d>coercing the <var>arg</var> context arguments for 2D</a>.<li><p>Create a new <code id=2dcontext:canvasrenderingcontext2d-9><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object.<li><p>Initialise its <code id=2dcontext:dom-context-2d-canvas-3><a href=#dom-context-2d-canvas>canvas</a></code> attribute to point to
<var>target</var>.<li><p>Let the new <code id=2dcontext:canvasrenderingcontext2d-10><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#output-bitmap id=2dcontext:output-bitmap-3>output bitmap</a> and
- <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-5>scratch bitmap</a> both be the same bitmap as <var>target</var>'s bitmap (so
+ <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-9>scratch bitmap</a> both be the same bitmap as <var>target</var>'s bitmap (so
that they are shared).<li><p><a href=#concept-canvas-set-bitmap-dimensions id=2dcontext:concept-canvas-set-bitmap-dimensions>Set bitmap dimensions</a> to the
numeric values of <var>target</var>'s <code id=2dcontext:attr-canvas-width><a href=#attr-canvas-width>width</a></code> and
- <code id=2dcontext:attr-canvas-height><a href=#attr-canvas-height>height</a></code> content attributes.<li><p>Return the new <code id=2dcontext:canvasrenderingcontext2d-11><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object.</ol>
+ <code id=2dcontext:attr-canvas-height><a href=#attr-canvas-height>height</a></code> content attributes.<li>
+ <p>Process each of the members of <var>settings</var> as follows:</p>
+
+ <dl><dt><dfn id=dom-canvasrenderingcontext2dsettings-alpha><code>alpha</code></dfn><dd>If false, then set the <var>target</var>'s bitmap's <a href=#concept-canvas-alpha id=2dcontext:concept-canvas-alpha-4>alpha</a> flag to false.</dl>
+
+ <li><p>Return the new <code id=2dcontext:canvasrenderingcontext2d-11><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object.</ol>
+
<hr>
<p>The <dfn id=dom-context-2d><code>CanvasRenderingContext2D()</code></dfn> constructor, when
invoked, must run the following steps:</p>
<ol><li><p>Create a new <code id=2dcontext:canvasrenderingcontext2d-12><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object.<li><p>Initialise its <code id=2dcontext:dom-context-2d-canvas-4><a href=#dom-context-2d-canvas>canvas</a></code> attribute to
- null.<li><p>Let the new <code id=2dcontext:canvasrenderingcontext2d-13><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-6>scratch bitmap</a> be
+ null.<li><p>Let the new <code id=2dcontext:canvasrenderingcontext2d-13><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-10>scratch bitmap</a> be
a new bitmap.<li><p>If the constructor was called with arguments, let <var>width</var> and <var>height</var> be the first and second arguments, respectively. Otherwise, let <var>width</var> and <var>height</var> be 300 and 150, respectively.<li><p><a href=#concept-canvas-set-bitmap-dimensions id=2dcontext:concept-canvas-set-bitmap-dimensions-2>Set bitmap dimensions</a> to <var>width</var> and <var>height</var>.<li><p>Let the new <code id=2dcontext:canvasrenderingcontext2d-14><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object have no <a href=#output-bitmap id=2dcontext:output-bitmap-4>output
bitmap</a>.<li><p>Return the new <code id=2dcontext:canvasrenderingcontext2d-15><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object.</ol>
<hr>
+ <p>When a user agent is required to <dfn id=coerce-context-arguments-for-2d>coerce context arguments for 2D</dfn>, it must run the
+ following steps:</p>
+
+ <ol><li><p>Let <var>input</var> be the argument to coerce.<li><p>Let <var>jsval</var> be the result of <a href=http://heycam.github.io/webidl/#es-type-mapping id=2dcontext:concept-idl-convert data-x-internal=concept-idl-convert>converting</a>
+ <var>input</var> to an ECMAScript value. If this throws an exception, then propagate the
+ exception and abort these steps.<li><p>Let <var>dict</var> be the result of <a href=http://heycam.github.io/webidl/#es-type-mapping id=2dcontext:concept-idl-convert-2 data-x-internal=concept-idl-convert>converting</a>
+ <var>jsval</var> to the dictionary type <code id=2dcontext:canvasrenderingcontext2dsettings><a href=#canvasrenderingcontext2dsettings>CanvasRenderingContext2DSettings</a></code>. If this
+ throws an exception, then propagate the exception and abort these steps.<li><p>Return <var>dict</var>.</ol>
+
+ <hr>
+
<p>When the user agent is required to <dfn id=commit-the-scratch-bitmap>commit the scratch bitmap</dfn> for a rendering
context, it must run the following steps:
- <ol><li><p>Let <var>bitmap copy</var> be a copy of the rendering context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-7>scratch
+ <ol><li><p>Let <var>bitmap copy</var> be a copy of the rendering context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-11>scratch
bitmap</a>.<li><p>Let <var>origin-clean flag copy</var> be a copy of the rendering context's
- <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-8>scratch bitmap</a>'s <a href=#concept-canvas-origin-clean id=2dcontext:concept-canvas-origin-clean-3>origin-clean</a>
+ <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-12>scratch bitmap</a>'s <a href=#concept-canvas-origin-clean id=2dcontext:concept-canvas-origin-clean-3>origin-clean</a>
flag.<li><p>Let <var>hit region list copy</var> be a copy of the rendering context's
- <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-9>scratch bitmap</a>'s <a href=#hit-region-list id=2dcontext:hit-region-list-2>hit region list</a>.<li><p>Let <var>list of pending interface actions copy</var> be a copy of the rendering
- context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-10>scratch bitmap</a>'s <a href=#list-of-pending-interface-actions id=2dcontext:list-of-pending-interface-actions>list of pending interface actions</a>.<li><p>Empty the <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-11>scratch bitmap</a>'s <a href=#list-of-pending-interface-actions id=2dcontext:list-of-pending-interface-actions-2>list of pending interface actions</a>.<li><p>If the rendering context has no <a href=#output-bitmap id=2dcontext:output-bitmap-5>output bitmap</a>, abort these steps.<li><p>Let <var>output bitmap</var> be the rendering context's <a href=#output-bitmap id=2dcontext:output-bitmap-6>output
+ <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-13>scratch bitmap</a>'s <a href=#hit-region-list id=2dcontext:hit-region-list-2>hit region list</a>.<li><p>Let <var>list of pending interface actions copy</var> be a copy of the rendering
+ context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-14>scratch bitmap</a>'s <a href=#list-of-pending-interface-actions id=2dcontext:list-of-pending-interface-actions>list of pending interface actions</a>.<li><p>Empty the <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-15>scratch bitmap</a>'s <a href=#list-of-pending-interface-actions id=2dcontext:list-of-pending-interface-actions-2>list of pending interface actions</a>.<li><p>If the rendering context has no <a href=#output-bitmap id=2dcontext:output-bitmap-5>output bitmap</a>, abort these steps.<li><p>Let <var>output bitmap</var> be the rendering context's <a href=#output-bitmap id=2dcontext:output-bitmap-6>output
bitmap</a>.<li><p>Let <var>canvas</var> be the <code id=2dcontext:the-canvas-element-6><a href=#the-canvas-element>canvas</a></code> element to which the rendering
context was most recently <a href=#concept-canvas-binding-steps id=2dcontext:concept-canvas-binding-steps-2>bound</a>.<li>
@@ -46342,8 +46389,8 @@
mode</a> is <a href=#concept-canvas-bound id=2dcontext:concept-canvas-bound>fixed</a>, throw an
<code id=2dcontext:invalidstateerror><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these steps.<li><p><a href=#commit-the-scratch-bitmap id=2dcontext:commit-the-scratch-bitmap>Commit the scratch bitmap</a> for the rendering context.</ol>
- <p class=note>The <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-12>scratch bitmap</a> is only <a href=#commit-the-scratch-bitmap id=2dcontext:commit-the-scratch-bitmap-2>committed</a> when the <code id=2dcontext:dom-context-2d-commit-3><a href=#dom-context-2d-commit>commit()</a></code> method is
- called. (This doesn't matter for <code id=2dcontext:the-canvas-element-7><a href=#the-canvas-element>canvas</a></code> elements in <a href=#concept-canvas-direct-2d id=2dcontext:concept-canvas-direct-2d>direct-2d</a> mode, since there the <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-13>scratch
+ <p class=note>The <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-16>scratch bitmap</a> is only <a href=#commit-the-scratch-bitmap id=2dcontext:commit-the-scratch-bitmap-2>committed</a> when the <code id=2dcontext:dom-context-2d-commit-3><a href=#dom-context-2d-commit>commit()</a></code> method is
+ called. (This doesn't matter for <code id=2dcontext:the-canvas-element-7><a href=#the-canvas-element>canvas</a></code> elements in <a href=#concept-canvas-direct-2d id=2dcontext:concept-canvas-direct-2d>direct-2d</a> mode, since there the <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-17>scratch
bitmap</a> is also the <code id=2dcontext:the-canvas-element-8><a href=#the-canvas-element>canvas</a></code> element's bitmap so every drawing operation is
immediately drawn.)</p>
@@ -46353,8 +46400,8 @@
dimensions</dfn> to <var>width</var> and <var>height</var>, it must run the
following steps:</p>
- <ol><li><p><a href=#reset-the-rendering-context-to-its-default-state id=2dcontext:reset-the-rendering-context-to-its-default-state>Reset the rendering context to its default state</a>.<li><p>Clear the <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-14>scratch bitmap</a>'s <a href=#hit-region-list id=2dcontext:hit-region-list-4>hit region list</a> and its <a href=#list-of-pending-interface-actions id=2dcontext:list-of-pending-interface-actions-3>list of
- pending interface actions</a>.<li><p>Resize the <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-15>scratch bitmap</a> to the new <var>width</var> and <var>height</var> and clear it to fully transparent black.<li><p>If the rendering context has an <a href=#output-bitmap id=2dcontext:output-bitmap-7>output bitmap</a>, and the <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-16>scratch
+ <ol><li><p><a href=#reset-the-rendering-context-to-its-default-state id=2dcontext:reset-the-rendering-context-to-its-default-state>Reset the rendering context to its default state</a>.<li><p>Clear the <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-18>scratch bitmap</a>'s <a href=#hit-region-list id=2dcontext:hit-region-list-4>hit region list</a> and its <a href=#list-of-pending-interface-actions id=2dcontext:list-of-pending-interface-actions-3>list of
+ pending interface actions</a>.<li><p>Resize the <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-19>scratch bitmap</a> to the new <var>width</var> and <var>height</var> and clear it to fully transparent black.<li><p>If the rendering context has an <a href=#output-bitmap id=2dcontext:output-bitmap-7>output bitmap</a>, and the <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-20>scratch
bitmap</a> is a different bitmap than the <a href=#output-bitmap id=2dcontext:output-bitmap-8>output bitmap</a>, then resize the
<a href=#output-bitmap id=2dcontext:output-bitmap-9>output bitmap</a> to the new <var>width</var> and <var>height</var>
and clear it to fully transparent black.<li>
@@ -46391,19 +46438,19 @@
<p>When the user agent is to run the <dfn id=concept-canvas-unbinding-steps>unbinding
steps</dfn> for a rendering context, it must run the following steps:</p>
- <ol><li><p><a href=#reset-the-rendering-context-to-its-default-state id=2dcontext:reset-the-rendering-context-to-its-default-state-2>Reset the rendering context to its default state</a>.<li><p>Clear the <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-17>scratch bitmap</a>'s <a href=#hit-region-list id=2dcontext:hit-region-list-5>hit region list</a> and its <a href=#list-of-pending-interface-actions id=2dcontext:list-of-pending-interface-actions-4>list of
- pending interface actions</a>.<li><p>Clear the <code id=2dcontext:canvasrenderingcontext2d-16><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-18>scratch bitmap</a> to a
- transparent black.<li><p>Set the <code id=2dcontext:canvasrenderingcontext2d-17><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-19>scratch bitmap</a>'s <a href=#concept-canvas-origin-clean id=2dcontext:concept-canvas-origin-clean-5>origin-clean</a> flag to true.<li><p>Let the <code id=2dcontext:canvasrenderingcontext2d-18><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object have no <a href=#output-bitmap id=2dcontext:output-bitmap-10>output
+ <ol><li><p><a href=#reset-the-rendering-context-to-its-default-state id=2dcontext:reset-the-rendering-context-to-its-default-state-2>Reset the rendering context to its default state</a>.<li><p>Clear the <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-21>scratch bitmap</a>'s <a href=#hit-region-list id=2dcontext:hit-region-list-5>hit region list</a> and its <a href=#list-of-pending-interface-actions id=2dcontext:list-of-pending-interface-actions-4>list of
+ pending interface actions</a>.<li><p>Clear the <code id=2dcontext:canvasrenderingcontext2d-16><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-22>scratch bitmap</a> to a
+ transparent black.<li><p>Set the <code id=2dcontext:canvasrenderingcontext2d-17><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-23>scratch bitmap</a>'s <a href=#concept-canvas-origin-clean id=2dcontext:concept-canvas-origin-clean-5>origin-clean</a> flag to true.<li><p>Let the <code id=2dcontext:canvasrenderingcontext2d-18><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object have no <a href=#output-bitmap id=2dcontext:output-bitmap-10>output
bitmap</a>.</ol>
<p>When the user agent is to run the <dfn id=concept-canvas-binding-steps>binding steps</dfn>
to bind the rendering context to the <code id=2dcontext:the-canvas-element-10><a href=#the-canvas-element>canvas</a></code> element <var>target</var>, it
must run the following steps:</p>
- <ol><li><p><a href=#reset-the-rendering-context-to-its-default-state id=2dcontext:reset-the-rendering-context-to-its-default-state-3>Reset the rendering context to its default state</a>.<li><p>Clear the <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-20>scratch bitmap</a>'s <a href=#hit-region-list id=2dcontext:hit-region-list-6>hit region list</a> and its <a href=#list-of-pending-interface-actions id=2dcontext:list-of-pending-interface-actions-5>list of
- pending interface actions</a>.<li><p>Resize the <code id=2dcontext:canvasrenderingcontext2d-19><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-21>scratch bitmap</a> to
+ <ol><li><p><a href=#reset-the-rendering-context-to-its-default-state id=2dcontext:reset-the-rendering-context-to-its-default-state-3>Reset the rendering context to its default state</a>.<li><p>Clear the <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-24>scratch bitmap</a>'s <a href=#hit-region-list id=2dcontext:hit-region-list-6>hit region list</a> and its <a href=#list-of-pending-interface-actions id=2dcontext:list-of-pending-interface-actions-5>list of
+ pending interface actions</a>.<li><p>Resize the <code id=2dcontext:canvasrenderingcontext2d-19><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-25>scratch bitmap</a> to
the dimensions of <var>target</var>'s bitmap and clear it to fully transparent
- black.<li><p>Set the <code id=2dcontext:canvasrenderingcontext2d-20><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-22>scratch bitmap</a>'s <a href=#concept-canvas-origin-clean id=2dcontext:concept-canvas-origin-clean-6>origin-clean</a> flag to true.<li><p>Let the <code id=2dcontext:canvasrenderingcontext2d-21><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#output-bitmap id=2dcontext:output-bitmap-11>output bitmap</a> be <var>target</var>'s bitmap.</ol>
+ black.<li><p>Set the <code id=2dcontext:canvasrenderingcontext2d-20><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-26>scratch bitmap</a>'s <a href=#concept-canvas-origin-clean id=2dcontext:concept-canvas-origin-clean-6>origin-clean</a> flag to true.<li><p>Let the <code id=2dcontext:canvasrenderingcontext2d-21><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#output-bitmap id=2dcontext:output-bitmap-11>output bitmap</a> be <var>target</var>'s bitmap.</ol>
<hr>
@@ -46411,15 +46458,15 @@
value it was initialised to when the object was created.</p>
<p>The <dfn id=dom-context-2d-width><code>width</code></dfn> attribute, on getting, must
- return the width of the rendering context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-23>scratch bitmap</a>, in CSS pixels. On
+ return the width of the rendering context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-27>scratch bitmap</a>, in CSS pixels. On
setting, it must <a href=#concept-canvas-set-bitmap-dimensions id=2dcontext:concept-canvas-set-bitmap-dimensions-3>set bitmap dimensions</a>
- to the new value and the current height of the rendering context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-24>scratch bitmap</a> in
+ to the new value and the current height of the rendering context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-28>scratch bitmap</a> in
CSS pixels, respectively.</p>
<p>The <dfn id=dom-context-2d-height><code>height</code></dfn> attribute, on getting, must
- return the height of the rendering context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-25>scratch bitmap</a>, in CSS pixels. On
+ return the height of the rendering context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-29>scratch bitmap</a>, in CSS pixels. On
setting, it must <a href=#concept-canvas-set-bitmap-dimensions id=2dcontext:concept-canvas-set-bitmap-dimensions-4>set bitmap dimensions</a>
- to the current width of the rendering context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-26>scratch bitmap</a> in CSS pixels and the
+ to the current width of the rendering context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-30>scratch bitmap</a> in CSS pixels and the
new value, respectively.</p>
<hr>
Modified: source
===================================================================
--- source 2014-09-08 21:47:40 UTC (rev 8754)
+++ source 2014-09-08 22:53:10 UTC (rev 8755)
@@ -2759,6 +2759,7 @@
<li><dfn data-x="dfn-read-only-array">Read only</dfn> (when applied to arrays)
<li><dfn data-x="dfn-callback-this-value">Callback this value</dfn>
<li><dfn>Convert a <code>DOMString</code> to a sequence of Unicode characters</dfn>
+ <li><dfn data-x="concept-idl-convert" data-x-href="http://heycam.github.io/webidl/#es-type-mapping">Converting</dfn> between WebIDL types and JS types
</ul>
<p>The Web IDL specification also defines the following types that are used in Web IDL fragments
@@ -59504,16 +59505,20 @@
<tr>
<th>"<dfn><code data-x="canvas-context-2d">2d</code></dfn>"
<td>
- Set the <code>canvas</code> element's <span data-x="concept-canvas-context-mode">context
- mode</span> to <span data-x="concept-canvas-direct-2d">direct-2d</span>; follow the <span>2D
+
+ Follow the <span>2D
context creation algorithm</span> defined in the section below, passing it the
- <code>canvas</code> element, to obtain a <code>CanvasRenderingContext2D</code> object; set
- that object's <span data-x="concept-canvas-context-bitmap-mode">context bitmap mode</span> to
+ <code>canvas</code> element and the method's <var>arguments...</var>, to obtain a <code>CanvasRenderingContext2D</code> object;
+ if this does not throw an exception, then
+ set the <code>canvas</code> element's <span data-x="concept-canvas-context-mode">context
+ mode</span> to <span data-x="concept-canvas-direct-2d">direct-2d</span>, set
+ the <code>CanvasRenderingContext2D</code> object's <span data-x="concept-canvas-context-bitmap-mode">context bitmap mode</span> to
<span data-x="concept-canvas-fixed">fixed</span>, and return the
<code>CanvasRenderingContext2D</code> object
+
<td>
Return the same object as was return the last time the method was invoked with this same
- argument.
+ first argument.
<td>
Return null.
<td>
@@ -59524,6 +59529,7 @@
<tr>
<th>"<dfn><code data-x="canvas-context-webgl">webgl</code></dfn>", if the user agent supports the WebGL feature in its current configuration
<td>
+
Follow the instructions given in the WebGL specification's <i>Context Creation</i> section to
obtain either a <code>WebGLRenderingContext</code> or null; if the returned value is null,
then return null and abort these steps, otherwise, set the <code>canvas</code> element's <span
@@ -59532,12 +59538,13 @@
<code>WebGLRenderingContext</code> object's <span
data-x="concept-canvas-context-bitmap-mode">context bitmap mode</span> to <span
data-x="concept-canvas-fixed">fixed</span>, and return the <code>WebGLRenderingContext</code>
- object‡ <ref spec=WEBGL>
+ object <ref spec=WEBGL>
+
<td>
Return null.
<td>
Return the same object as was return the last time the method was invoked with this same
- argument.
+ first argument.
<td>
Throw an <code>InvalidStateError</code> exception.
<td>
@@ -59579,10 +59586,6 @@
data-x="canvas-context-webgl">webgl</code>" value in the case of a user agent having exhausted the
graphics hardware's abilities and having no software fallback implementation.</small></p>
- <p class="tablenote"><small>‡ The second (and subsequent) argument(s) to the method, if
- any, are ignored in all cases except this one. See the WebGL specification for
- details.</small></p>
-
<hr>
<p>The <dfn><code data-x="dom-canvas-probablySupportsContext">probablySupportsContext(<var>contextId</var>,
@@ -59893,6 +59896,10 @@
enum <dfn>CanvasFillRule</dfn> { "<span data-x="dom-context-2d-fillRule-nonzero">nonzero</span>", "<span data-x="dom-context-2d-fillRule-evenodd">evenodd</span>" };
+dictionary <dfn>CanvasRenderingContext2DSettings</dfn> {
+ boolean <span data-x="dom-CanvasRenderingContext2DSettings-alpha">alpha</span> = true;
+}
+
[<span data-x="dom-context-2d">Constructor</span>(optional unsigned long width, unsigned long height), Exposed=(Window,Worker)]
interface <dfn>CanvasRenderingContext2D</dfn> {
@@ -60128,13 +60135,16 @@
<dl class="domintro">
- <dt><var>context</var> = <var>canvas</var> . <code data-x="dom-canvas-getContext">getContext</code>('2d')</dt>
+ <dt><var>context</var> = <var>canvas</var> . <code data-x="dom-canvas-getContext">getContext</code>('2d' [, { [ <code data-x="dom-CanvasRenderingContext2DSettings-alpha">alpha</code>: false ] } ] )</dt>
<dd>
<p>Returns a <code>CanvasRenderingContext2D</code> object that is permanently bound to a
particular <code>canvas</code> element.</p>
+ <p>If the <code data-x="dom-CanvasRenderingContext2DSettings-alpha">alpha</code> setting is
+ provided and set to false, then the canvas is forced to always be opaque.</p>
+
</dd>
<dt><var>context</var> = new <code data-x="dom-context-2d">CanvasRenderingContext2D</code>( [ <var>width</var>, <var>height</var> ] )</dt>
@@ -60200,11 +60210,34 @@
<!--REMOVE-TOPIC:Security-->
<p>These bitmaps also have a <span>hit region list</span>, which is described in a later section.
- Initially, this list is empty. <span data-x="scratch bitmap">Scratch bitmaps</span> also have a
+ Initially, this list is empty.</p>
+
+ <p><span data-x="scratch bitmap">Scratch bitmaps</span> have a
<dfn>list of pending interface actions</dfn>, which can contain instructions to draw the user's
attention to a location on the bitmap, and instructions to scroll to a location on the bitmap.
Initially, this list is also empty.</p>
+ <p><span data-x="scratch bitmap">Scratch bitmaps</span> also have an <dfn
+ data-x="concept-canvas-alpha">alpha</dfn> flag, which can be set to true or false. Initially, when
+ one of these bitmaps is created, its <span data-x="concept-canvas-alpha">alpha</span> flag must be
+ set to true. When a <span>scratch bitmap</span> has its <span
+ data-x="concept-canvas-alpha">alpha</span> flag set to false, then its alpha channel must be fixed
+ to 1.0 (fully opaque) for all pixels, and attempts to change the alpha component of any pixel must
+ be silently ignored.</p>
+
+ <p class="note">Thus, such a bitmap starts off as fully-opaque black instead of fully-tranparent
+ black; <code data-x="dom-context-2d-clearRect">clearRect()</code> always results in fully-opaque
+ black pixels, every fourth byte from <code
+ data-x="dom-context-2d-getImageData">getImageData()</code> is always 255, the <code
+ data-x="dom-context-2d-putImageData">putImageData()</code> method effectively ignores every fourth
+ byte in its input, and so on. However, the alpha component of styles and images drawn onto the
+ canvas are still honoured up to the point where they would impact the <span>scratch
+ bitmap</span>'s alpha channel; for instance, drawing a 50% transparent white square on a freshly
+ created <span>scratch bitmap</span> with its <span data-x="concept-canvas-alpha">alpha</span> flag
+ set to false will result in a fully-opaque gray square.</p>
+
+ <hr>
+
<p>The <code>CanvasRenderingContext2D</code> 2D rendering context represents a flat linear
Cartesian surface whose origin (0,0) is at the top left corner, with the coordinate space having
<var>x</var> values increasing when going right, and <var>y</var> values
@@ -60223,10 +60256,16 @@
<hr>
<p>The <dfn>2D context creation algorithm</dfn>, which is passed a <var>target</var> (a
- <code>canvas</code> element), consists of running the following steps:</p>
+ <code>canvas</code> element) and optionally some arguments, consists of running the following steps:</p>
<ol>
+ <li><p>If the algorithm was passed some arguments, let <var>arg</var> be the first such argument.
+ Otherwise, let <var>arg</var> be <i>undefined</i>.</p></li>
+
+ <li><p>Let <var>settings</var> be the result of <span data-x="coerce context arguments for
+ 2D">coercing the <var>arg</var> context arguments for 2D</span>.</p></li>
+
<li><p>Create a new <code>CanvasRenderingContext2D</code> object.</p></li>
<li><p>Initialise its <code data-x="dom-context-2d-canvas">canvas</code> attribute to point to
@@ -60240,6 +60279,21 @@
numeric values of <var>target</var>'s <code data-x="attr-canvas-width">width</code> and
<code data-x="attr-canvas-height">height</code> content attributes.</p></li>
+ <li>
+
+ <p>Process each of the members of <var>settings</var> as follows:</p>
+
+ <dl>
+
+ <dt><dfn><code data-x="dom-CanvasRenderingContext2DSettings-alpha">alpha</code></dfn></dt>
+
+ <dd>If false, then set the <var>target</var>'s bitmap's <span
+ data-x="concept-canvas-alpha">alpha</span> flag to false.</dd>
+
+ </dl>
+
+ </li>
+
<li><p>Return the new <code>CanvasRenderingContext2D</code> object.</p></li>
</ol>
@@ -60277,6 +60331,27 @@
<hr>
+ <p>When a user agent is required to <dfn>coerce context arguments for 2D</dfn>, it must run the
+ following steps:</p>
+
+ <ol>
+
+ <li><p>Let <var>input</var> be the argument to coerce.</p></li>
+
+ <li><p>Let <var>jsval</var> be the result of <span data-x="concept-idl-convert">converting</span>
+ <var>input</var> to an ECMAScript value. If this throws an exception, then propagate the
+ exception and abort these steps.</p></li>
+
+ <li><p>Let <var>dict</var> be the result of <span data-x="concept-idl-convert">converting</span>
+ <var>jsval</var> to the dictionary type <code>CanvasRenderingContext2DSettings</code>. If this
+ throws an exception, then propagate the exception and abort these steps.</p></li>
+
+ <li><p>Return <var>dict</var>.</p></li>
+
+ </ol>
+
+ <hr>
+
<p>When the user agent is required to <dfn>commit the scratch bitmap</dfn> for a rendering
context, it must run the following steps:
More information about the Commit-Watchers
mailing list