Skip to content

Commit

Permalink
[gow] (2) Changes to <canvas> color correction requirements
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.whatwg.org/webapps@1196 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Feb 3, 2008
1 parent f3fa9b4 commit b382946
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 18 deletions.
33 changes: 26 additions & 7 deletions index
Expand Up @@ -24,7 +24,7 @@

<h1 id=html-5>HTML 5</h1>

<h2 class="no-num no-toc" id=working>Working Draft &mdash; 2 February 2008</h2>
<h2 class="no-num no-toc" id=working>Working Draft &mdash; 3 February 2008</h2>

<p>You can take part in this work. <a
href="http://www.whatwg.org/mailing-list">Join the working group's
Expand Down Expand Up @@ -17687,7 +17687,7 @@ notes on what would need to be defined for dashed lines:

// support methods
function FillPlasma(data, color) { ... }
function AddCload(data, x, y) { ... }
function AddCloud(data, x, y) { ... }
</pre>
</div>

Expand Down Expand Up @@ -17804,26 +17804,45 @@ notes on what would need to be defined for dashed lines:

<p>The <code><a href="#canvas">canvas</a></code> APIs must perform colour
correction at only two points: when rendering images with their own gamma
correction information onto the canvas, to convert the image to the color
space used by the canvas (e.g. using the <code
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="#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>Thus, in the 2D context, colors used to draw shapes onto the canvas will
exactly match colors obtained through the <code
<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="#getimagedata">getImageData()</a></code> method.

<p>The <code title=dom-canvas-toDataURL><a
href="#todataurl">toDataURL()</a></code> method must not include color
space information in the resource returned.
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="#todataurl">toDataURL()</a></code>
must match those returned by the code
title="dom-context-2d-getImageData">getImageData() method.

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

<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="#img">img</a></code> element would use the same colors as one
painted on a <code><a href="#canvas">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="#todataurl">toDataURL()</a></code>
method) must be rendered with no color correction.

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

<h5 id=security1><span class=secno>3.14.11.3. </span>Security with <code><a
href="#canvas">canvas</a></code> elements</h5>

Expand Down
40 changes: 29 additions & 11 deletions source
Expand Up @@ -15282,7 +15282,7 @@ notes on what would need to be defined for dashed lines:

// support methods
function FillPlasma(data, color) { ... }
function AddCload(data, x, y) { ... }
function AddCloud(data, x, y) { ... }
</pre>

</div>
Expand Down Expand Up @@ -15411,26 +15411,44 @@ notes on what would need to be defined for dashed lines:

<p>The <code>canvas</code> APIs must perform colour correction at
only two points: when rendering images with their own gamma
correction 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>

<p>Thus, in the 2D context, colors used to draw shapes onto the
canvas will exactly match colors obtained through the <code
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>

<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">getImageData()</code>
method.</p>

<p>The <code title="dom-canvas-toDataURL">toDataURL()</code> method
must not include color space information in the resource
returned.</p>
returned. 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.</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 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>


<h5>Security with <code>canvas</code> elements</h5>
Expand Down

0 comments on commit b382946

Please sign in to comment.