Skip to content

Commit

Permalink
[e] (0) Splitting out the 2D Context spec.
Browse files Browse the repository at this point in the history
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 d7361ca
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 17 deletions.
20 changes: 15 additions & 5 deletions complete.html
Expand Up @@ -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>

Expand Down Expand Up @@ -24045,6 +24047,8 @@ <h4 id=the-canvas-element><span class=secno>4.8.11 </span>The <dfn id=canvas><co
define their own contexts, which would return different
objects.</span></p>



<div class=impl>

<p>Vendors may also define experimental contexts using the syntax
Expand Down Expand Up @@ -24141,16 +24145,21 @@ <h4 id=the-canvas-element><span class=secno>4.8.11 </span>The <dfn id=canvas><co

</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
Expand Down Expand Up @@ -26974,7 +26983,8 @@ <h6 id=examples><span class=secno>4.8.11.1.14 </span>Examples</h6>

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





<div class=impl>

Expand All @@ -26983,10 +26993,10 @@ <h5 id=color-spaces-and-color-correction><span class=secno>4.8.11.2 </span>Color
<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>
Expand Down
20 changes: 15 additions & 5 deletions index
Expand Up @@ -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>

Expand Down Expand Up @@ -23898,6 +23900,8 @@ interface <dfn>CueRangeCallback</dfn> {
define their own contexts, which would return different
objects.</span></p>



<div class=impl>

<p>Vendors may also define experimental contexts using the syntax
Expand Down Expand Up @@ -23994,16 +23998,21 @@ interface <dfn>CueRangeCallback</dfn> {

</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
Expand Down Expand Up @@ -26827,7 +26836,8 @@ function AddCloud(data, x, y) { ... }</pre>

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





<div class=impl>

Expand All @@ -26836,10 +26846,10 @@ function AddCloud(data, x, y) { ... }</pre>
<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>
Expand Down
37 changes: 30 additions & 7 deletions source
Expand Up @@ -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>

Expand Down Expand Up @@ -25906,6 +25910,8 @@ interface <dfn>CueRangeCallback</dfn> {

</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
Expand All @@ -25915,6 +25921,11 @@ interface <dfn>CueRangeCallback</dfn> {
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
Expand Down Expand Up @@ -26034,17 +26045,28 @@ interface <dfn>CueRangeCallback</dfn> {

</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
Expand Down Expand Up @@ -29417,7 +29439,8 @@ function AddCloud(data, x, y) { ... }</pre>

&lt;/script></pre>


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

<div class="impl">

Expand All @@ -29426,10 +29449,10 @@ function AddCloud(data, x, y) { ... }</pre>
<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
Expand Down Expand Up @@ -96457,7 +96480,7 @@ interface <span>HTMLDocument</span> {

<!--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-->

Expand Down Expand Up @@ -97254,7 +97277,7 @@ interface <span>HTMLDocument</span> {

<!--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 -->
Expand Down

0 comments on commit d7361ca

Please sign in to comment.