Skip to content

Commit

Permalink
[giow] (0) Provide a switch to disable drawImage()'s smoothing.
Browse files Browse the repository at this point in the history
Affected topics: Canvas

git-svn-id: http://svn.whatwg.org/webapps@7031 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Mar 27, 2012
1 parent 3d14895 commit 4be18d9
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 8 deletions.
33 changes: 30 additions & 3 deletions complete.html
Expand Up @@ -240,7 +240,7 @@

<header class=head id=head><p><a class=logo href=http://www.whatwg.org/><img alt=WHATWG height=101 src=/images/logo width=101></a></p>
<hgroup><h1 class=allcaps>HTML</h1>
<h2 class="no-num no-toc">Living Standard &mdash; Last Updated 26 March 2012</h2>
<h2 class="no-num no-toc">Living Standard &mdash; Last Updated 27 March 2012</h2>
</hgroup><dl><dt><strong>Web developer edition:</strong></dt>
<dd><strong><a href=http://developers.whatwg.org/>http://developers.whatwg.org/</a></strong></dd>
<dt>Multiple-page version:</dt>
Expand Down Expand Up @@ -34958,6 +34958,7 @@ <h5 id=2dcontext><span class=secno>4.8.11.1 </span>The 2D context</h5>
<a href=#textmetrics>TextMetrics</a> <a href=#dom-context-2d-measuretext title=dom-context-2d-measureText>measureText</a>(DOMString text);

// drawing images
attribute boolean <a href=#dom-context-2d-imagesmoothingenabled title=dom-context-2d-imageSmoothingEnabled>imageSmoothingEnabled</a>; // (default true)
void <a href=#dom-context-2d-drawimage title=dom-context-2d-drawImage>drawImage</a>((<a href=#htmlimageelement>HTMLImageElement</a> or <a href=#htmlcanvaselement>HTMLCanvasElement</a> or <a href=#htmlvideoelement>HTMLVideoElement</a>) image, double dx, double dy);
void <a href=#dom-context-2d-drawimage title=dom-context-2d-drawImage>drawImage</a>((<a href=#htmlimageelement>HTMLImageElement</a> or <a href=#htmlcanvaselement>HTMLCanvasElement</a> or <a href=#htmlvideoelement>HTMLVideoElement</a>) image, double dx, double dy, double dw, double dh);
void <a href=#dom-context-2d-drawimage title=dom-context-2d-drawImage>drawImage</a>((<a href=#htmlimageelement>HTMLImageElement</a> or <a href=#htmlcanvaselement>HTMLCanvasElement</a> or <a href=#htmlvideoelement>HTMLVideoElement</a>) image, double sx, double sy, double sw, double sh, double dx, double dy, double dw, double dh);
Expand Down Expand Up @@ -38065,6 +38066,19 @@ <h6 id=drawing-images-to-the-canvas><span class=secno>4.8.11.1.12 </span>Drawing

</dd>

<dt><var title="">context</var> . <code title=dom-context-2d-imageSmoothingEnabled><a href=#dom-context-2d-imagesmoothingenabled>imageSmoothingEnabled</a></code> [ = <var title="">value</var> ]</dt>

<dd>

<p>Returns whether the <code title=dom-context-2d-drawImage><a href=#dom-context-2d-drawimage>drawImage()</a></code> method will
attempt to smooth the image if it has to rescale it (as opposed to
just rendering the image with "big pixels").</p>

<p>Can be set, to change whether images are smoothed (true) or not
(false).</p>

</dd>

</dl><div class=impl>

<p>If not specified, the <var title="">dw</var> and <var title="">dh</var> arguments must default to the values of <var title="">sw</var> and <var title="">sh</var>, interpreted such that
Expand Down Expand Up @@ -38128,8 +38142,15 @@ <h6 id=drawing-images-to-the-canvas><span class=secno>4.8.11.1.12 </span>Drawing
suggested that 5,5,-2,-2 was different than 3,3,2,2; this is trying
to clarify that this is no the case. --></p>

<p class=note>This specification does not define the algorithm to
use when scaling the image, if necessary.</p>
<p>If the <code title=dom-context-2d-imageSmoothingEnabled><a href=#dom-context-2d-imagesmoothingenabled>imageSmoothingEnabled</a></code>
attribute is set to true, then the user agent should attempt to
apply a smoothing algorithm to the image data when it is scaled.
Otherwise, the image must be rendered using nearest-neighbor
interpolation.</p>

<p class=note>This specification does not define the precise
algorithm to use when scaling an image when the <code title=dom-context-2d-imageSmoothingEnabled><a href=#dom-context-2d-imagesmoothingenabled>imageSmoothingEnabled</a></code>
attribute is set to true.</p>

<p class=note>When a canvas is drawn onto itself, the <a href=#drawing-model>drawing
model</a> requires the source to be copied before the image is drawn
Expand Down Expand Up @@ -38169,6 +38190,12 @@ <h6 id=drawing-images-to-the-canvas><span class=secno>4.8.11.1.12 </span>Drawing
subject to <a href=#shadows title=shadows>shadow effects</a>, <a href=#dom-context-2d-globalalpha title=dom-context-2d-globalAlpha>global alpha</a>, the <a href=#clipping-region title="clipping region">clipping region</a>, and <a href=#dom-context-2d-globalcompositeoperation title=dom-context-2d-globalCompositeOperation>global composition
operators</a>.</p>

<p>The <dfn id=dom-context-2d-imagesmoothingenabled title=dom-context-2d-imageSmoothingEnabled><code>imageSmoothingEnabled</code></dfn>
attribute, on getting, must return the last value it was set to. On
setting, it must be set to the new value. When the
<code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object is create, the
attribute must be set to true.</p>

</div>


Expand Down
33 changes: 30 additions & 3 deletions index
Expand Up @@ -240,7 +240,7 @@

<header class=head id=head><p><a class=logo href=http://www.whatwg.org/><img alt=WHATWG height=101 src=/images/logo width=101></a></p>
<hgroup><h1 class=allcaps>HTML</h1>
<h2 class="no-num no-toc">Living Standard &mdash; Last Updated 26 March 2012</h2>
<h2 class="no-num no-toc">Living Standard &mdash; Last Updated 27 March 2012</h2>
</hgroup><dl><dt><strong>Web developer edition:</strong></dt>
<dd><strong><a href=http://developers.whatwg.org/>http://developers.whatwg.org/</a></strong></dd>
<dt>Multiple-page version:</dt>
Expand Down Expand Up @@ -34958,6 +34958,7 @@ dictionary <dfn id=trackeventinit>TrackEventInit</dfn> : <a href=#eventinit>Even
<a href=#textmetrics>TextMetrics</a> <a href=#dom-context-2d-measuretext title=dom-context-2d-measureText>measureText</a>(DOMString text);

// drawing images
attribute boolean <a href=#dom-context-2d-imagesmoothingenabled title=dom-context-2d-imageSmoothingEnabled>imageSmoothingEnabled</a>; // (default true)
void <a href=#dom-context-2d-drawimage title=dom-context-2d-drawImage>drawImage</a>((<a href=#htmlimageelement>HTMLImageElement</a> or <a href=#htmlcanvaselement>HTMLCanvasElement</a> or <a href=#htmlvideoelement>HTMLVideoElement</a>) image, double dx, double dy);
void <a href=#dom-context-2d-drawimage title=dom-context-2d-drawImage>drawImage</a>((<a href=#htmlimageelement>HTMLImageElement</a> or <a href=#htmlcanvaselement>HTMLCanvasElement</a> or <a href=#htmlvideoelement>HTMLVideoElement</a>) image, double dx, double dy, double dw, double dh);
void <a href=#dom-context-2d-drawimage title=dom-context-2d-drawImage>drawImage</a>((<a href=#htmlimageelement>HTMLImageElement</a> or <a href=#htmlcanvaselement>HTMLCanvasElement</a> or <a href=#htmlvideoelement>HTMLVideoElement</a>) image, double sx, double sy, double sw, double sh, double dx, double dy, double dw, double dh);
Expand Down Expand Up @@ -38065,6 +38066,19 @@ v6DVT (also check for '- -' bits in the part above) --><p>The <dfn id=dom-contex

</dd>

<dt><var title="">context</var> . <code title=dom-context-2d-imageSmoothingEnabled><a href=#dom-context-2d-imagesmoothingenabled>imageSmoothingEnabled</a></code> [ = <var title="">value</var> ]</dt>

<dd>

<p>Returns whether the <code title=dom-context-2d-drawImage><a href=#dom-context-2d-drawimage>drawImage()</a></code> method will
attempt to smooth the image if it has to rescale it (as opposed to
just rendering the image with "big pixels").</p>

<p>Can be set, to change whether images are smoothed (true) or not
(false).</p>

</dd>

</dl><div class=impl>

<p>If not specified, the <var title="">dw</var> and <var title="">dh</var> arguments must default to the values of <var title="">sw</var> and <var title="">sh</var>, interpreted such that
Expand Down Expand Up @@ -38128,8 +38142,15 @@ v6DVT (also check for '- -' bits in the part above) --><p>The <dfn id=dom-contex
suggested that 5,5,-2,-2 was different than 3,3,2,2; this is trying
to clarify that this is no the case. --></p>

<p class=note>This specification does not define the algorithm to
use when scaling the image, if necessary.</p>
<p>If the <code title=dom-context-2d-imageSmoothingEnabled><a href=#dom-context-2d-imagesmoothingenabled>imageSmoothingEnabled</a></code>
attribute is set to true, then the user agent should attempt to
apply a smoothing algorithm to the image data when it is scaled.
Otherwise, the image must be rendered using nearest-neighbor
interpolation.</p>

<p class=note>This specification does not define the precise
algorithm to use when scaling an image when the <code title=dom-context-2d-imageSmoothingEnabled><a href=#dom-context-2d-imagesmoothingenabled>imageSmoothingEnabled</a></code>
attribute is set to true.</p>

<p class=note>When a canvas is drawn onto itself, the <a href=#drawing-model>drawing
model</a> requires the source to be copied before the image is drawn
Expand Down Expand Up @@ -38169,6 +38190,12 @@ v6DVT (also check for '- -' bits in the part above) --><p>The <dfn id=dom-contex
subject to <a href=#shadows title=shadows>shadow effects</a>, <a href=#dom-context-2d-globalalpha title=dom-context-2d-globalAlpha>global alpha</a>, the <a href=#clipping-region title="clipping region">clipping region</a>, and <a href=#dom-context-2d-globalcompositeoperation title=dom-context-2d-globalCompositeOperation>global composition
operators</a>.</p>

<p>The <dfn id=dom-context-2d-imagesmoothingenabled title=dom-context-2d-imageSmoothingEnabled><code>imageSmoothingEnabled</code></dfn>
attribute, on getting, must return the last value it was set to. On
setting, it must be set to the new value. When the
<code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object is create, the
attribute must be set to true.</p>

</div>


Expand Down
35 changes: 33 additions & 2 deletions source
Expand Up @@ -40640,6 +40640,7 @@ dictionary <dfn>TrackEventInit</dfn> : <span>EventInit</span> {
<span>TextMetrics</span> <span title="dom-context-2d-measureText">measureText</span>(DOMString text);

// drawing images
attribute boolean <span title="dom-context-2d-imageSmoothingEnabled">imageSmoothingEnabled</span>; // (default true)
void <span title="dom-context-2d-drawImage">drawImage</span>((<span>HTMLImageElement</span> or <span>HTMLCanvasElement</span> or <span>HTMLVideoElement</span>) image, double dx, double dy);
void <span title="dom-context-2d-drawImage">drawImage</span>((<span>HTMLImageElement</span> or <span>HTMLCanvasElement</span> or <span>HTMLVideoElement</span>) image, double dx, double dy, double dw, double dh);
void <span title="dom-context-2d-drawImage">drawImage</span>((<span>HTMLImageElement</span> or <span>HTMLCanvasElement</span> or <span>HTMLVideoElement</span>) image, double sx, double sy, double sw, double sh, double dx, double dy, double dw, double dh);
Expand Down Expand Up @@ -44340,6 +44341,20 @@ v6DVT (also check for '- -' bits in the part above) -->

</dd>

<dt><var title="">context</var> . <code title="dom-context-2d-imageSmoothingEnabled">imageSmoothingEnabled</code> [ = <var title="">value</var> ]</dt>

<dd>

<p>Returns whether the <code
title="dom-context-2d-drawImage">drawImage()</code> method will
attempt to smooth the image if it has to rescale it (as opposed to
just rendering the image with "big pixels").</p>

<p>Can be set, to change whether images are smoothed (true) or not
(false).</p>

</dd>

</dl>

<div class="impl">
Expand Down Expand Up @@ -44427,8 +44442,17 @@ v6DVT (also check for '- -' bits in the part above) -->
suggested that 5,5,-2,-2 was different than 3,3,2,2; this is trying
to clarify that this is no the case. --></p>

<p class="note">This specification does not define the algorithm to
use when scaling the image, if necessary.</p>
<p>If the <code
title="dom-context-2d-imageSmoothingEnabled">imageSmoothingEnabled</code>
attribute is set to true, then the user agent should attempt to
apply a smoothing algorithm to the image data when it is scaled.
Otherwise, the image must be rendered using nearest-neighbor
interpolation.</p>

<p class="note">This specification does not define the precise
algorithm to use when scaling an image when the <code
title="dom-context-2d-imageSmoothingEnabled">imageSmoothingEnabled</code>
attribute is set to true.</p>

<p class="note">When a canvas is drawn onto itself, the <span>drawing
model</span> requires the source to be copied before the image is drawn
Expand Down Expand Up @@ -44473,6 +44497,13 @@ v6DVT (also check for '- -' bits in the part above) -->
title="dom-context-2d-globalCompositeOperation">global composition
operators</span>.</p>

<p>The <dfn
title="dom-context-2d-imageSmoothingEnabled"><code>imageSmoothingEnabled</code></dfn>
attribute, on getting, must return the last value it was set to. On
setting, it must be set to the new value. When the
<code>CanvasRenderingContext2D</code> object is create, the
attribute must be set to true.</p>

</div>


Expand Down

0 comments on commit 4be18d9

Please sign in to comment.