Skip to content
Permalink
Browse files

[e] (0) Splitting out the 2D Context spec.

Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=8331

git-svn-id: http://svn.whatwg.org/webapps@4544 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information...
Hixie committed Jan 8, 2010
1 parent d909c27 commit d7361caa2b97eb16ddb9ccf8893eb1b49b9ee145
Showing with 60 additions and 17 deletions.
  1. +15 −5 complete.html
  2. +15 −5 index
  3. +30 −7 source
@@ -4479,6 +4479,8 @@ <h4 id=colors><span class=secno>2.4.6 </span>Colors</h4>
context</a> has a separate color syntax that also handles
opacity.</p>




<h4 id=space-separated-tokens><span class=secno>2.4.7 </span>Space-separated tokens</h4>

define their own contexts, which would return different
objects.</span></p>



<div class=impl>

<p>Vendors may also define experimental contexts using the syntax

</div>



<h5 id=the-2d-context><span class=secno>4.8.11.1 </span>The 2D context</h5>

<!-- v2: we're on v4. suggestions for next version are marked v5. -->

<p>When the <code title=dom-canvas-getContext><a href=#dom-canvas-getcontext>getContext()</a></code>
method of a <code><a href=#the-canvas-element>canvas</a></code> element is invoked with <dfn id=canvas-context-2d title=canvas-context-2d><code>2d</code></dfn> as the argument, a
<code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object is returned.</p>



<div class=impl>


<p>There is only one <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object
per canvas, so calling the <code title=dom-canvas-getContext><a href=#dom-canvas-getcontext>getContext()</a></code> method with the
<code title=canvas-context-2d><a href=#canvas-context-2d>2d</a></code> argument a second time

&lt;/script&gt;</pre>





<div class=impl>

<p>The <code><a href=#the-canvas-element>canvas</a></code> APIs must perform color correction at
only two points: when rendering images with their own gamma
correction and color space information onto the canvas, to convert
the image to the color space used by the canvas (e.g. using the
<code title=dom-context-2d-drawImage><a href=#dom-context-2d-drawimage>drawImage()</a></code> method
with an <code><a href=#htmlimageelement>HTMLImageElement</a></code> object), and when rendering
the actual canvas bitmap to the output device.</p>
the image to the color space used by the canvas (e.g. using the 2D
Context's <code title=dom-context-2d-drawImage><a href=#dom-context-2d-drawimage>drawImage()</a></code>
method with an <code><a href=#htmlimageelement>HTMLImageElement</a></code> object), and when
rendering the actual canvas bitmap to the output device.</p>

<p class=note>Thus, in the 2D context, colors used to draw shapes
onto the canvas will exactly match colors obtained through the <code title=dom-context-2d-getImageData><a href=#dom-context-2d-getimagedata>getImageData()</a></code>
20 index
@@ -4332,6 +4332,8 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d
context</a> has a separate color syntax that also handles
opacity.</p>




<h4 id=space-separated-tokens><span class=secno>2.4.7 </span>Space-separated tokens</h4>

define their own contexts, which would return different
objects.</span></p>



<div class=impl>

<p>Vendors may also define experimental contexts using the syntax

</div>



<h5 id=the-2d-context><span class=secno>4.8.11.1 </span>The 2D context</h5>

<!-- v2: we're on v4. suggestions for next version are marked v5. -->

<p>When the <code title=dom-canvas-getContext><a href=#dom-canvas-getcontext>getContext()</a></code>
method of a <code><a href=#the-canvas-element>canvas</a></code> element is invoked with <dfn id=canvas-context-2d title=canvas-context-2d><code>2d</code></dfn> as the argument, a
<code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object is returned.</p>



<div class=impl>


<p>There is only one <code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object
per canvas, so calling the <code title=dom-canvas-getContext><a href=#dom-canvas-getcontext>getContext()</a></code> method with the
<code title=canvas-context-2d><a href=#canvas-context-2d>2d</a></code> argument a second time

&lt;/script&gt;</pre>





<div class=impl>

<p>The <code><a href=#the-canvas-element>canvas</a></code> APIs must perform color correction at
only two points: when rendering images with their own gamma
correction and color space information onto the canvas, to convert
the image to the color space used by the canvas (e.g. using the
<code title=dom-context-2d-drawImage><a href=#dom-context-2d-drawimage>drawImage()</a></code> method
with an <code><a href=#htmlimageelement>HTMLImageElement</a></code> object), and when rendering
the actual canvas bitmap to the output device.</p>
the image to the color space used by the canvas (e.g. using the 2D
Context's <code title=dom-context-2d-drawImage><a href=#dom-context-2d-drawimage>drawImage()</a></code>
method with an <code><a href=#htmlimageelement>HTMLImageElement</a></code> object), and when
rendering the actual canvas bitmap to the output device.</p>

<p class=note>Thus, in the 2D context, colors used to draw shapes
onto the canvas will exactly match colors obtained through the <code title=dom-context-2d-getImageData><a href=#dom-context-2d-getimagedata>getImageData()</a></code>
37 source
@@ -3844,10 +3844,14 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d

<hr>

<!--END html5-->

<p class="note">The <span title="canvas-context-2d">2D graphics
context</span> has a separate color syntax that also handles
opacity.</p>

<!--START html5-->


<h4>Space-separated tokens</h4>


</dl>

<!--END html5-->

<p>This specification only defines one context, with the name "<code
title="canvas-context-2d">2d</code>". <span class="impl">If <code
title="dom-canvas-getContext">getContext()</code> is called with
define their own contexts, which would return different
objects.</span></p>

<!--START html5-->
<!--END complete--><!--END html-->
<p>Contexts are defined by other specifications.</p>
<!--START complete--><!--START html-->

<div class="impl">

<p>Vendors may also define experimental contexts using the syntax

</div>

<!--END html5-->

<h5>The 2D context</h5>

<!-- v2: we're on v4. suggestions for next version are marked v5. -->

<p>When the <code title="dom-canvas-getContext">getContext()</code>
method of a <code>canvas</code> element is invoked with <dfn
title="canvas-context-2d"><code>2d</code></dfn> as the argument, a
<code>CanvasRenderingContext2D</code> object is returned.</p>

<!--START 2dcontext-->

<div class="impl">

<!--END html--><!--END complete-->
<p>When the <code title="dom-canvas-getContext">getContext()</code>
method of a <code>canvas</code> element is invoked with <dfn
title="canvas-context-2d"><code>2d</code></dfn> as the argument, a
<code>CanvasRenderingContext2D</code> object must be returned.</p>
<!--START html--><!--START complete-->

<p>There is only one <code>CanvasRenderingContext2D</code> object
per canvas, so calling the <code
title="dom-canvas-getContext">getContext()</code> method with the

&lt;/script></pre>


<!--END 2dcontext-->
<!--START html5-->

<div class="impl">

<p>The <code>canvas</code> APIs must perform color correction at
only two points: when rendering images with their own gamma
correction and color space information onto the canvas, to convert
the image to the color space used by the canvas (e.g. using the
<code title="dom-context-2d-drawImage">drawImage()</code> method
with an <code>HTMLImageElement</code> object), and when rendering
the actual canvas bitmap to the output device.</p>
the image to the color space used by the canvas (e.g. using the 2D
Context's <code title="dom-context-2d-drawImage">drawImage()</code>
method with an <code>HTMLImageElement</code> object), and when
rendering the actual canvas bitmap to the output device.</p>

<p class="note">Thus, in the 2D context, colors used to draw shapes
onto the canvas will exactly match colors obtained through the <code

<!--START complete-->

<!--START html-device--><!--START microdata-->
<!--START html-device--><!--START microdata--><!--START 2dcontext-->
<!--START websocket-api--><!--START storage--><!--START database--><!--START eventsource--><!--START workers-->
<!--START vocabs--><!--START vCard--><!--START vEvent--><!--START work-->


<!--END vocabs--><!--END vCard--><!--END vEvent--><!--END work-->
<!--END websocket-api--><!--END storage--><!--END database--><!--END eventsource--><!--END workers-->
<!--END html-device--><!--END microdata-->
<!--END html-device--><!--END microdata--><!--END 2dcontext-->


<h2 class="no-num">Acknowledgements</h2> <!-- ACKS -->

0 comments on commit d7361ca

Please sign in to comment.
You can’t perform that action at this time.