Skip to content

Commit

Permalink
[e] (0) Fix the prose regarding color spaces to handle the toDataURLH…
Browse files Browse the repository at this point in the history
…D stuff properly. Also, fix some of the wording in general. Also, cleanup.

Affected topics: Canvas

git-svn-id: http://svn.whatwg.org/webapps@7395 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Sep 24, 2012
1 parent 881669f commit a75fa5e
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 99 deletions.
55 changes: 23 additions & 32 deletions complete.html
Original file line number Diff line number Diff line change
Expand Up @@ -42018,46 +42018,37 @@ <h6 id=examples><span class=secno>4.8.11.1.21 </span>Examples</h6>

</div><!--data-component-->

<!--2DCONTEXT-->

<div class=impl>

<h5 id=color-spaces-and-color-correction><span class=secno>4.8.11.2 </span>Color spaces and color correction</h5>

<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 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>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 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-getImageDataHD><a href=#dom-context-2d-getimagedatahd>getImageDataHD()</a></code>
method.</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-getImageDataHD><a href=#dom-context-2d-getimagedatahd>getImageDataHD()</a></code> method.</p>

<p>The <code title=dom-canvas-toDataURL><a href=#dom-canvas-todataurl>toDataURL()</a></code> method
must not include color space information in the resource returned.
Where the output format allows it, the color of pixels in resources
created by <code title=dom-canvas-toDataURL><a href=#dom-canvas-todataurl>toDataURLHD()</a></code>
must match those returned by the <code title=dom-context-2d-getImageDataHD><a href=#dom-context-2d-getimagedatahd>getImageDataHD()</a></code>
method.</p>
<p>The <code title=dom-canvas-toDataURL><a href=#dom-canvas-todataurl>toDataURL()</a></code> and <code title=dom-canvas-toDataURLHD><a href=#dom-canvas-todataurlhd>toDataURLHD()</a></code> methods must not include color space
information in the resources they return. Where the output format allows it, the color of pixels
in resources created by <code title=dom-canvas-toDataURL><a href=#dom-canvas-todataurl>toDataURL()</a></code> must match those
returned by the <code title=dom-context-2d-getImageData><a href=#dom-context-2d-getimagedata>getImageData()</a></code> method, and the
color of pixels in resources created by <code title=dom-canvas-toDataURLHD><a href=#dom-canvas-todataurlhd>toDataURLHD()</a></code>
must match those returned by the <code title=dom-context-2d-getImageDataHD><a href=#dom-context-2d-getimagedatahd>getImageDataHD()</a></code> method.</p>

<p>In user agents that support CSS, the color space used by a <code><a href=#the-canvas-element>canvas</a></code> element must
match the color space used for processing any colors for that element in CSS.</p>

<p>The gamma correction and color space information of images must be handled in such a way that
an image rendered directly using an <code><a href=#the-img-element>img</a></code> element would use the same colors as one
painted on a <code><a href=#the-canvas-element>canvas</a></code> element that is then itself rendered. Furthermore, the rendering
of images that have no color correction information (such as those returned by the <code title=dom-canvas-toDataURL><a href=#dom-canvas-todataurl>toDataURL()</a></code> method) must be rendered with no color
correction.</p>

<p>In user agents that support CSS, the color space used by a
<code><a href=#the-canvas-element>canvas</a></code> element must match the color space used for
processing any colors for that element in CSS.</p>

<p>The gamma correction and color space information of images must
be handled in such a way that an image rendered directly using an
<code><a href=#the-img-element>img</a></code> element would use the same colors as one painted on
a <code><a href=#the-canvas-element>canvas</a></code> element that is then itself
rendered. Furthermore, the rendering of images that have no color
correction information (such as those returned by the <code title=dom-canvas-toDataURL><a href=#dom-canvas-todataurl>toDataURL()</a></code> method) must be
rendered with no color correction.</p>

<p class=note>Thus, in the 2D context, calling the <code title=dom-context-2d-drawImage><a href=#dom-context-2d-drawimage>drawImage()</a></code> method to render
the output of the <code title=dom-canvas-toDataURL><a href=#dom-canvas-todataurl>toDataURL()</a></code> method to the
canvas, given the appropriate dimensions, has no visible effect.</p>
<p class=note>Thus, in the 2D context, calling the <code title=dom-context-2d-drawImage><a href=#dom-context-2d-drawimage>drawImage()</a></code> method to render the output of the <code title=dom-canvas-toDataURLHD><a href=#dom-canvas-todataurlhd>toDataURLHD()</a></code> method to the canvas, given the appropriate
dimensions, has no visible effect.</p>

</div>

Expand Down
55 changes: 23 additions & 32 deletions index
Original file line number Diff line number Diff line change
Expand Up @@ -42018,46 +42018,37 @@ function AddCloud(data, x, y) { ... }</pre>

</div><!--data-component-->

<!--2DCONTEXT-->

<div class=impl>

<h5 id=color-spaces-and-color-correction><span class=secno>4.8.11.2 </span>Color spaces and color correction</h5>

<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 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>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 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-getImageDataHD><a href=#dom-context-2d-getimagedatahd>getImageDataHD()</a></code>
method.</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-getImageDataHD><a href=#dom-context-2d-getimagedatahd>getImageDataHD()</a></code> method.</p>

<p>The <code title=dom-canvas-toDataURL><a href=#dom-canvas-todataurl>toDataURL()</a></code> method
must not include color space information in the resource returned.
Where the output format allows it, the color of pixels in resources
created by <code title=dom-canvas-toDataURL><a href=#dom-canvas-todataurl>toDataURLHD()</a></code>
must match those returned by the <code title=dom-context-2d-getImageDataHD><a href=#dom-context-2d-getimagedatahd>getImageDataHD()</a></code>
method.</p>
<p>The <code title=dom-canvas-toDataURL><a href=#dom-canvas-todataurl>toDataURL()</a></code> and <code title=dom-canvas-toDataURLHD><a href=#dom-canvas-todataurlhd>toDataURLHD()</a></code> methods must not include color space
information in the resources they return. Where the output format allows it, the color of pixels
in resources created by <code title=dom-canvas-toDataURL><a href=#dom-canvas-todataurl>toDataURL()</a></code> must match those
returned by the <code title=dom-context-2d-getImageData><a href=#dom-context-2d-getimagedata>getImageData()</a></code> method, and the
color of pixels in resources created by <code title=dom-canvas-toDataURLHD><a href=#dom-canvas-todataurlhd>toDataURLHD()</a></code>
must match those returned by the <code title=dom-context-2d-getImageDataHD><a href=#dom-context-2d-getimagedatahd>getImageDataHD()</a></code> method.</p>

<p>In user agents that support CSS, the color space used by a <code><a href=#the-canvas-element>canvas</a></code> element must
match the color space used for processing any colors for that element in CSS.</p>

<p>The gamma correction and color space information of images must be handled in such a way that
an image rendered directly using an <code><a href=#the-img-element>img</a></code> element would use the same colors as one
painted on a <code><a href=#the-canvas-element>canvas</a></code> element that is then itself rendered. Furthermore, the rendering
of images that have no color correction information (such as those returned by the <code title=dom-canvas-toDataURL><a href=#dom-canvas-todataurl>toDataURL()</a></code> method) must be rendered with no color
correction.</p>

<p>In user agents that support CSS, the color space used by a
<code><a href=#the-canvas-element>canvas</a></code> element must match the color space used for
processing any colors for that element in CSS.</p>

<p>The gamma correction and color space information of images must
be handled in such a way that an image rendered directly using an
<code><a href=#the-img-element>img</a></code> element would use the same colors as one painted on
a <code><a href=#the-canvas-element>canvas</a></code> element that is then itself
rendered. Furthermore, the rendering of images that have no color
correction information (such as those returned by the <code title=dom-canvas-toDataURL><a href=#dom-canvas-todataurl>toDataURL()</a></code> method) must be
rendered with no color correction.</p>

<p class=note>Thus, in the 2D context, calling the <code title=dom-context-2d-drawImage><a href=#dom-context-2d-drawimage>drawImage()</a></code> method to render
the output of the <code title=dom-canvas-toDataURL><a href=#dom-canvas-todataurl>toDataURL()</a></code> method to the
canvas, given the appropriate dimensions, has no visible effect.</p>
<p class=note>Thus, in the 2D context, calling the <code title=dom-context-2d-drawImage><a href=#dom-context-2d-drawimage>drawImage()</a></code> method to render the output of the <code title=dom-canvas-toDataURLHD><a href=#dom-canvas-todataurlhd>toDataURLHD()</a></code> method to the canvas, given the appropriate
dimensions, has no visible effect.</p>

</div>

Expand Down
63 changes: 28 additions & 35 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -49046,51 +49046,44 @@ function AddCloud(data, x, y) { ... }</pre>

</div><!--data-component-->

<!--START w3c-html--><!--2DCONTEXT-->

<div class="impl">

<h5>Color spaces and color correction</h5>

<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 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
title="dom-context-2d-getImageDataHD">getImageDataHD()</code>
method.</p>

<p>The <code title="dom-canvas-toDataURL">toDataURL()</code> method
must not include color space information in the resource returned.
Where the output format allows it, the color of pixels in resources
created by <code title="dom-canvas-toDataURL">toDataURLHD()</code>
<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 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
title="dom-context-2d-getImageDataHD">getImageDataHD()</code> method.</p>

<p>The <code title="dom-canvas-toDataURL">toDataURL()</code> and <code
title="dom-canvas-toDataURLHD">toDataURLHD()</code> methods must not include color space
information in the resources they return. Where the output format allows it, the color of pixels
in resources created by <code title="dom-canvas-toDataURL">toDataURL()</code> must match those
returned by the <code title="dom-context-2d-getImageData">getImageData()</code> method, and the
color of pixels in resources created by <code title="dom-canvas-toDataURLHD">toDataURLHD()</code>
must match those returned by the <code
title="dom-context-2d-getImageDataHD">getImageDataHD()</code>
method.</p>
title="dom-context-2d-getImageDataHD">getImageDataHD()</code> method.</p>

<p>In user agents that support CSS, the color space used by a
<code>canvas</code> element must match the color space used for
processing any colors for that element in CSS.</p>
<p>In user agents that support CSS, the color space used by a <code>canvas</code> element must
match the color space used for processing any colors for that element in CSS.</p>

<p>The gamma correction and color space information of images must
be handled in such a way that an image rendered directly using an
<code>img</code> element would use the same colors as one painted on
a <code>canvas</code> element that is then itself
rendered. Furthermore, the rendering of images that have no color
correction information (such as those returned by the <code
title="dom-canvas-toDataURL">toDataURL()</code> method) must be
rendered with no color correction.</p>
<p>The gamma correction and color space information of images must be handled in such a way that
an image rendered directly using an <code>img</code> element would use the same colors as one
painted on a <code>canvas</code> element that is then itself rendered. Furthermore, the rendering
of images that have no color correction information (such as those returned by the <code
title="dom-canvas-toDataURL">toDataURL()</code> method) must be rendered with no color
correction.</p>

<p class="note">Thus, in the 2D context, calling the <code
title="dom-context-2d-drawImage">drawImage()</code> method to render
the output of the <code
title="dom-canvas-toDataURL">toDataURL()</code> method to the
canvas, given the appropriate dimensions, has no visible effect.</p>
title="dom-context-2d-drawImage">drawImage()</code> method to render the output of the <code
title="dom-canvas-toDataURLHD">toDataURLHD()</code> method to the canvas, given the appropriate
dimensions, has no visible effect.</p>

</div>

Expand Down

0 comments on commit a75fa5e

Please sign in to comment.