[html5] r7577 - [giow] (3) Disambiguate some canvas drawImage() behaviour. Affected topics: Canv [...]

whatwg at whatwg.org whatwg at whatwg.org
Mon Dec 10 10:26:08 PST 2012


Author: ianh
Date: 2012-12-10 10:26:07 -0800 (Mon, 10 Dec 2012)
New Revision: 7577

Modified:
   complete.html
   index
   source
Log:
[giow] (3) Disambiguate some canvas drawImage() behaviour.
Affected topics: Canvas, HTML

Modified: complete.html
===================================================================
--- complete.html	2012-12-10 05:53:32 UTC (rev 7576)
+++ complete.html	2012-12-10 18:26:07 UTC (rev 7577)
@@ -38896,13 +38896,21 @@
     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 filtering algorithm
     requires a pixel value from outside the original image data, it must instead use the value from
-    the nearest edge pixel. (That is, the filter uses 'clamp-to-edge' behavior.)</p>
+    the nearest edge pixel. (That is, the filter uses 'clamp-to-edge' behavior.) When the filtering
+    algorithm requires a pixel value from outside the source rectangle but inside the original image
+    data, then the value from the original image data must be used.</p>
     <!-- see CORE-32111 and:
          http://krijnhoetmer.nl/irc-logs/whatwg/20100818#l-737
          http://www.w3.org/Bugs/Public/show_bug.cgi?id=10799#c11
     -->
     <!-- createPattern() has a similar paragraph with different rules -->
 
+    <p class=note>Thus, scaling an image in parts or in whole will have the same effect. This does
+    mean that when sprites coming from a single sprite sheet are to be scaled, adjacent images in
+    the sprite sheet can interfere. This can be avoided by ensuring each sprite in the sheet is
+    surrounded by a border of transparent black, or by copying sprites to be scaled into temporary
+    <code><a href=#the-canvas-element>canvas</a></code> elements and drawing the scaled sprites from there.</p>
+
     <p>Images are painted without affecting the current path, and are 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>clipping region</a>, and <a href=#dom-context-2d-globalcompositeoperation title=dom-context-2d-globalCompositeOperation>global composition operators</a>.</p>
 
@@ -104314,6 +104322,7 @@
   Kelly Ford,
   Kelly Norton,
   Kevin Benson,
+  Kevin Gadd,
   Kevin Cole,
   Kornél Pál,
   Kornel Lesinski,

Modified: index
===================================================================
--- index	2012-12-10 05:53:32 UTC (rev 7576)
+++ index	2012-12-10 18:26:07 UTC (rev 7577)
@@ -38896,13 +38896,21 @@
     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 filtering algorithm
     requires a pixel value from outside the original image data, it must instead use the value from
-    the nearest edge pixel. (That is, the filter uses 'clamp-to-edge' behavior.)</p>
+    the nearest edge pixel. (That is, the filter uses 'clamp-to-edge' behavior.) When the filtering
+    algorithm requires a pixel value from outside the source rectangle but inside the original image
+    data, then the value from the original image data must be used.</p>
     <!-- see CORE-32111 and:
          http://krijnhoetmer.nl/irc-logs/whatwg/20100818#l-737
          http://www.w3.org/Bugs/Public/show_bug.cgi?id=10799#c11
     -->
     <!-- createPattern() has a similar paragraph with different rules -->
 
+    <p class=note>Thus, scaling an image in parts or in whole will have the same effect. This does
+    mean that when sprites coming from a single sprite sheet are to be scaled, adjacent images in
+    the sprite sheet can interfere. This can be avoided by ensuring each sprite in the sheet is
+    surrounded by a border of transparent black, or by copying sprites to be scaled into temporary
+    <code><a href=#the-canvas-element>canvas</a></code> elements and drawing the scaled sprites from there.</p>
+
     <p>Images are painted without affecting the current path, and are 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>clipping region</a>, and <a href=#dom-context-2d-globalcompositeoperation title=dom-context-2d-globalCompositeOperation>global composition operators</a>.</p>
 
@@ -104314,6 +104322,7 @@
   Kelly Ford,
   Kelly Norton,
   Kevin Benson,
+  Kevin Gadd,
   Kevin Cole,
   Kornél Pál,
   Kornel Lesinski,

Modified: source
===================================================================
--- source	2012-12-10 05:53:32 UTC (rev 7576)
+++ source	2012-12-10 18:26:07 UTC (rev 7577)
@@ -45452,13 +45452,21 @@
     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 filtering algorithm
     requires a pixel value from outside the original image data, it must instead use the value from
-    the nearest edge pixel. (That is, the filter uses 'clamp-to-edge' behavior.)</p>
+    the nearest edge pixel. (That is, the filter uses 'clamp-to-edge' behavior.) When the filtering
+    algorithm requires a pixel value from outside the source rectangle but inside the original image
+    data, then the value from the original image data must be used.</p>
     <!-- see CORE-32111 and:
          http://krijnhoetmer.nl/irc-logs/whatwg/20100818#l-737
          http://www.w3.org/Bugs/Public/show_bug.cgi?id=10799#c11
     -->
     <!-- createPattern() has a similar paragraph with different rules -->
 
+    <p class="note">Thus, scaling an image in parts or in whole will have the same effect. This does
+    mean that when sprites coming from a single sprite sheet are to be scaled, adjacent images in
+    the sprite sheet can interfere. This can be avoided by ensuring each sprite in the sheet is
+    surrounded by a border of transparent black, or by copying sprites to be scaled into temporary
+    <code>canvas</code> elements and drawing the scaled sprites from there.</p>
+
     <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>clipping region</span>, and <span
@@ -122090,6 +122098,7 @@
   Kelly Ford,
   Kelly Norton,
   Kevin Benson,
+  Kevin Gadd,
   Kevin Cole,
   Kornél Pál,
   Kornel Lesinski,




More information about the Commit-Watchers mailing list