HTML Standard Tracker

Filter

File a bug

SVNBugCommentTime (UTC)
7031[Gecko] [Internet Explorer] [Opera] [Webkit] Provide a switch to disable drawImage()'s smoothing.2012-03-27 22:06
@@ -40633,20 +40633,21 @@ dictionary <dfn>TrackEventInit</dfn> : <span>EventInit</span> {
   boolean <span title="dom-context-2d-isPointInPath">isPointInPath</span>(<span>Path</span> path, double x, double y);
 
   // text (see also the <span>CanvasDrawingStyles</span> interface)
   void <span title="dom-context-2d-fillText">fillText</span>(DOMString text, double x, double y, optional double maxWidth);
   void <span title="dom-context-2d-strokeText">strokeText</span>(DOMString text, double x, double y, optional double maxWidth);<!-- v6DVT
   void <span title="dom-context-2d-fillVerticalText">fillVerticalText</span>(DOMString text, double x, double y, optional double maxHeight);
   void <span title="dom-context-2d-strokeVerticalText">strokeVerticalText</span>(DOMString text, double x, double y, optional double maxHeight); -->
   <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);
 
   // hit regions
   void <span title="dom-context-2d-addHitRegion">addHitRegion</span>(<span>HitRegionOptions</span> options);
 
   // pixel manipulation
   <span>ImageData</span> <span title="dom-context-2d-createImageData">createImageData</span>(double sw, double sh);
   <span>ImageData</span> <span title="dom-context-2d-createImageData">createImageData</span>(<span>ImageData</span> imagedata);
@@ -44333,20 +44334,34 @@ v6DVT (also check for '- -' bits in the part above) -->
     <p>If the first argument isn't an <code>img</code>,
     <code>canvas</code>, or <code>video</code> element, throws a
     <code>TypeMismatchError</code> exception. If the image has no
     image data, throws an <code>InvalidStateError</code> exception. If
     the one of the source rectangle dimensions is zero, throws an
     <code>IndexSizeError</code> exception. If the image isn't yet
     fully decoded, then nothing is drawn.</p>
 
    </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">
 
   <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
   one CSS pixel in the image is treated as one unit in the canvas
   coordinate space. If the <var title="">sx</var>, <var
   title="">sy</var>, <var title="">sw</var>, and <var
@@ -44420,22 +44435,31 @@ v6DVT (also check for '- -' bits in the part above) -->
   <p>The original image data of the source image must be used, not the
   image as it is rendered (e.g. <code
   title="attr-dim-width">width</code> and <code
   title="attr-dim-height">height</code> attributes on the source
   element have no effect). The image data must be processed in the
   original direction, even if the dimensions given are negative. <!--
   remove that last sentence if it causes confusion. Someone once
   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
   back onto the canvas, so it is possible to copy parts of a canvas
   onto overlapping parts of itself.</p>
 
   <p>If the original image data is a bitmap image, the value painted
   at a point in the destination rectangle is computed by filtering the
   original image data. The user agent may use any filtering algorithm
   (for example bilinear interpolation or nearest-neighbor). When the
@@ -44466,20 +44490,27 @@ v6DVT (also check for '- -' bits in the part above) -->
   correction has been applied).</p>
   <!-- createPattern() has an equivalent paragraph -->
 
   <p>Images are painted without affecting the current path, and are
   subject to <span title="shadows">shadow effects</span>, <span
   title="dom-context-2d-globalAlpha">global alpha</span>, the <span
   title="clipping region">clipping region</span>, and <span
   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>
 
 
   <h6>Hit regions</h6>
 
   <p>Each <code>canvas</code> element whose <span>primary
   context</span> is a <code>CanvasRenderingContext2D</code> object
   must have a <dfn>hit region list</dfn> associated with its
   bitmap.</p>
 

|