HTML Standard Tracker

Diff (omit for latest revision)
Filter

Short URL: http://html5.org/r/2845

File a bug

SVNBugCommentTime (UTC)
2845[Gecko] [Opera] [Webkit] Define that <canvas>'s drawImage() can take a <video>.2009-02-20 01:10
Index: source
===================================================================
--- source	(revision 2844)
+++ source	(revision 2845)
@@ -19034,10 +19034,11 @@
 
   <p>When no video data is available (the element's <code
   title="dom-media-readyState">readyState</code> attribute is either
-  <code title="dom-media-HAVE_NOTHING">HAVE_NOTHING</code> or <code
-  title="dom-media-HAVE_METADATA">HAVE_METADATA</code>), the
-  <code>video</code> element <span>represents</span> either the
-  <span>poster frame</span>, or nothing.</p>
+  <code title="dom-media-HAVE_NOTHING">HAVE_NOTHING</code>, or <code
+  title="dom-media-HAVE_METADATA">HAVE_METADATA</code> but no video
+  data has yet been obtained at all), the <code>video</code> element
+  <span>represents</span> either the <span>poster frame</span>, or
+  nothing.</p>
 
   <p>When a <code>video</code> element is <span
   title="dom-media-paused">paused</span> and the <span title="current
@@ -21956,11 +21957,13 @@
   void <span title="dom-context-2d-strokeVerticalText">strokeVerticalText</span>(in DOMString text, in float x, in float y, [Optional] in float maxHeight); -->
   <span>TextMetrics</span> <span title="dom-context-2d-measureText">measureText</span>(in DOMString text);
 
-  // drawing images<!-- XXX add and define HTMLVideoElement variants -->
+  // drawing images
   void <span title="dom-context-2d-drawImage">drawImage</span>(in <span>HTMLImageElement</span> image, in float dx, in float dy, [Optional] in float dw, in float dh);
   void <span title="dom-context-2d-drawImage">drawImage</span>(in <span>HTMLImageElement</span> image, in float sx, in float sy, in float sw, in float sh, in float dx, in float dy, in float dw, in float dh);
   void <span title="dom-context-2d-drawImage">drawImage</span>(in <span>HTMLCanvasElement</span> image, in float dx, in float dy, [Optional] in float dw, in float dh);
   void <span title="dom-context-2d-drawImage">drawImage</span>(in <span>HTMLCanvasElement</span> image, in float sx, in float sy, in float sw, in float sh, in float dx, in float dy, in float dw, in float dh);
+  void <span title="dom-context-2d-drawImage">drawImage</span>(in <span>HTMLVideoElement</span> image, in float dx, in float dy, [Optional] in float dw, in float dh);
+  void <span title="dom-context-2d-drawImage">drawImage</span>(in <span>HTMLVideoElement</span> image, in float sx, in float sy, in float sw, in float sh, in float dx, in float dy, in float dw, in float dh);
 
   // pixel manipulation
   <span>ImageData</span> <span title="dom-context-2d-createImageData">createImageData</span>(in float sw, in float sh);
@@ -23696,33 +23699,34 @@
   title="dom-context-2d-drawImage"><code>drawImage</code></dfn> method
   can be used.</p>
 
-  <p>This method is overloaded with three variants: <code
-  title="">drawImage(<var title="">image</var>, <var
-  title="">dx</var>, <var title="">dy</var>)</code>, <code
-  title="">drawImage(<var title="">image</var>, <var
-  title="">dx</var>, <var title="">dy</var>, <var title="">dw</var>,
-  <var title="">dh</var>)</code>, and <code title="">drawImage(<var
-  title="">image</var>, <var title="">sx</var>, <var
-  title="">sy</var>, <var title="">sw</var>, <var title="">sh</var>,
-  <var title="">dx</var>, <var title="">dy</var>, <var
-  title="">dw</var>, <var title="">dh</var>)</code>. (Actually it is
-  overloaded with six; each of those three can take either an
-  <code>HTMLImageElement</code> or an <code>HTMLCanvasElement</code>
-  for the <var title="">image</var> argument.)  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 title="">sh</var> arguments are omitted, they must default
-  to 0, 0, the image's intrinsic width in image pixels, and the
-  image's intrinsic height in image pixels, respectively.</p>
+  <p>This method can be invoked with three different sets of argments:</p>
 
+  <ul class="brief">
+   <li><code title="">drawImage(<var title="">image</var>, <var title="">dx</var>, <var title="">dy</var>)</code>
+   <li><code title="">drawImage(<var title="">image</var>, <var title="">dx</var>, <var title="">dy</var>, <var title="">dw</var>, <var title="">dh</var>)</code>
+   <li><code title="">drawImage(<var title="">image</var>, <var title="">sx</var>, <var title="">sy</var>, <var title="">sw</var>, <var title="">sh</var>, <var title="">dx</var>, <var title="">dy</var>, <var title="">dw</var>, <var title="">dh</var>)</code>
+  </ul>
+
+  <p>Each of those three can take either an
+  <code>HTMLImageElement</code>, an <code>HTMLCanvasElement</code>, or
+  an <code>HTMLVideoElement</code> for the <var title="">image</var>
+  argument.</p>
+
+  <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
+  title="">sh</var> arguments are omitted, they must default to 0, 0,
+  the image's intrinsic width in image pixels, and the image's
+  intrinsic height in image pixels, respectively.</p>
+
   <p>The <var title="">image</var> argument must be an instance of an
-  <code>HTMLImageElement</code> or <code>HTMLCanvasElement</code>. If
-  the <var title="">image</var> is of the wrong type or null, the
-  implementation must raise a <code>TYPE_MISMATCH_ERR</code>
-  exception.</p>
+  <code>HTMLImageElement</code>, <code>HTMLCanvasElement</code>, or
+  <code>HTMLVideoElement</code>. If the <var title="">image</var> is
+  of the wrong type or null, the implementation must raise a
+  <code>TYPE_MISMATCH_ERR</code> exception.</p>
   <!-- createPattern() has an equivalent paragraph -->
 
   <p>If the <var title="">image</var> argument is an
@@ -23732,15 +23736,23 @@
   exception.</p>
   <!-- createPattern() has an equivalent paragraph -->
 
-  <!-- handled by the next paragraph
+  <!-- handled by a later paragraph
   <p>If the <var title="">image</var> argument is an
   <code>HTMLCanvasElement</code> object with either a horizontal
   dimension or a vertical dimension equal to zero, then the
-  implementation must raise an <code>INVALID_STATE_ERR</code>
+  implementation must raise an <code>INVALID_SIZE_ERR</code>
   exception.</p>
   -->
   <!-- createPattern() has an equivalent paragraph -->
 
+  <p>If the <var title="">image</var> argument is an
+  <code>HTMLVideoElement</code> object whose <code
+  title="dom-media-readyState">readyState</code> attribute is either
+  <code title="dom-media-HAVE_NOTHING">HAVE_NOTHING</code> or <code
+  title="dom-media-HAVE_METADATA">HAVE_METADATA</code>, then the
+  implementation must raise an <code>INVALID_STATE_ERR</code>
+  exception.</p>
+
   <p>The source rectangle is the rectangle whose corners are the four
   points (<var title="">sx</var>, <var title="">sy</var>), (<span><var
   title="">sx</var>+<var title="">sw</var></span>, <var
@@ -23780,11 +23792,16 @@
 
   <p>When the <code
   title="dom-context-2d-drawImage">drawImage()</code> method is
-  passed, as its <var title="">image</var> argument, an animated
-  image, the poster frame of the animation, or the first frame of the
-  animation if there is no poster frame, must be used.</p>
+  passed, as its <var title="">image</var> argument, an
+  <code>HTMLImageElement</code> representing an animated image, the
+  poster frame of the animation, or the first frame of the animation
+  if there is no poster frame, must be used.</p>
   <!-- createPattern() has an equivalent paragraph -->
 
+  <p>When the <var title="">image</var> argument is an
+  <code>HTMLVideoElement</code>, then the frame at the <span>current
+  playback position</span> must be used as the source image.</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

|