[html5] r6134 - [giow] (0) Attempt to define canvas.toBlob().

whatwg at whatwg.org whatwg at whatwg.org
Thu May 12 13:40:42 PDT 2011


Author: ianh
Date: 2011-05-12 13:40:41 -0700 (Thu, 12 May 2011)
New Revision: 6134

Modified:
   complete.html
   index
   source
Log:
[giow] (0) Attempt to define canvas.toBlob().

Modified: complete.html
===================================================================
--- complete.html	2011-05-12 19:51:30 UTC (rev 6133)
+++ complete.html	2011-05-12 20:40:41 UTC (rev 6134)
@@ -33824,9 +33824,8 @@
            attribute unsigned long <a href=#dom-canvas-width title=dom-canvas-width>width</a>;
            attribute unsigned long <a href=#dom-canvas-height title=dom-canvas-height>height</a>;
 
-  DOMString <a href=#dom-canvas-todataurl title=dom-canvas-toDataURL>toDataURL</a>(in optional DOMString type, in any... args);<!--
-  v5:
-  void <span title="dom-canvas-toBlob">toBlob</span>(in <span>FileCallback</span>, in optional DOMString type, in any... args);-->
+  DOMString <a href=#dom-canvas-todataurl title=dom-canvas-toDataURL>toDataURL</a>(in optional DOMString type, in any... args);
+  void <a href=#dom-canvas-toblob title=dom-canvas-toBlob>toBlob</a>(in <span>FileCallback</span>, in optional DOMString type, in any... args);
 
   object <a href=#dom-canvas-getcontext title=dom-canvas-getContext>getContext</a>(in DOMString contextId, in any... args);
 };</pre>
@@ -34060,80 +34059,122 @@
     type, and control the way that the image is generated, as given in
     the table below.</p>
 
+    <p>When trying to use types other than "<code>image/png</code>",
+    authors can check if the image was really returned in the
+    requested format by checking to see if the returned string starts
+    with one of the exact strings "<code title="">data:image/png,</code>" or "<code title="">data:image/png;</code>". If it does, the image is PNG,
+    and thus the requested type was not supported. (The one exception
+    to this is if the canvas has either no height or no width, in
+    which case the result might simply be "<code title="">data:,</code>".)</p>
+
    </dd>
 
-   <!-- v5: toBlob -->
+   <dt><var title="">canvas</var> . <code title=dom-canvas-toBlob><a href=#dom-canvas-toblob>toBlob</a></code>(<var title="">callback</var> [, <var title="">type</var>, ... ])</dt>
 
+   <dd>
+
+    <p>Creates a <code><a href=#blob>Blob</a></code> object representing a file
+    containing the image in the canvas, and invokes a callback with a
+    handle to that object.</p>
+
+    <p>The second argument, if provided, controls the type of the
+    image to be returned (e.g. PNG or JPEG). The default is <code title="">image/png</code>; that type is also used if the given
+    type isn't supported. The other arguments are specific to the
+    type, and control the way that the image is generated, as given in
+    the table below.</p>
+
+   </dd>
+
   </dl><div class=impl>
 
   <p>The <dfn id=dom-canvas-todataurl title=dom-canvas-toDataURL><code>toDataURL()</code></dfn> method
-  must, when called with no arguments, return a <a href=#data-protocol title="data
-  protocol"><code title="">data:</code> URL</a> containing a
-  representation of the image as a PNG file. <a href=#refsPNG>[PNG]</a> <a href=#refsRFC2397>[RFC2397]</a></p>
+  must run the following steps:</p>
 
-<!--
-  v5:
-  void <span title="dom-canvas-toBlob">toBlob</span>(in <span>FileCallback</span>, in optional DOMString type, in any... args);
--->
+  <ol><li><p>If the canvas has no pixels (i.e. either its horizontal
+   dimension or its vertical dimension is zero) then return the string
+   "<code title="">data:,</code>" and abort these steps. (This is the
+   shortest <a href=#data-protocol title="data protocol"><code title="">data:</code>
+   URL</a>; it represents the empty string in a <code title="">text/plain</code> resource.)</li>
 
-  <p>If the canvas has no pixels (i.e. either its horizontal dimension
-  or its vertical dimension is zero) then the method must return the
-  string "<code title="">data:,</code>". (This is the shortest <a href=#data-protocol title="data protocol"><code title="">data:</code> URL</a>; it
-  represents the empty string in a <code title="">text/plain</code>
-  resource.)</p>
+   <li><p>Let <var title="">file</var> be <a href=#a-serialization-of-the-image-as-a-file>a serialization of the
+   image as a file</a>, using the method's arguments (if any) as
+   the <var title="">arguments</var>.</li>
 
-  <p>When the <code title=dom-canvas-toDataURL><a href=#dom-canvas-todataurl>toDataURL(<var title="">type</var>)</a></code> method is called with one <em>or
-  more</em> arguments, it must return a <a href=#data-protocol title="data
-  protocol"><code title="">data:</code> URL</a> containing a
-  representation of the image in the format given by <var title="">type</var>. The possible values are <a href=#mime-type title="MIME
-  type">MIME types</a> with no parameters, for example
-  <code>image/png</code>, <code>image/jpeg</code>, or even maybe
-  <code>image/svg+xml</code> if the implementation actually keeps
-  enough information to reliably render an SVG image from the
-  canvas.</p>
+   <li><p>Return a <a href=#data-protocol title="data protocol"><code title="">data:</code> URL</a> representing <var title="">file</var>. <a href=#refsRFC2397>[RFC2397]</a></p>
 
-  <p>For image types that do not support an alpha channel, the image
-  must be composited onto a solid black background using the
-  source-over operator, and the resulting image must be the one used
-  to create the <a href=#data-protocol title="data protocol"><code title="">data:</code> URL</a>.</p>
+   <!-- should we explicitly require the URL to be base64-encoded and
+   not have any parameters, to ensure the same exact URL is generated
+   in each browser? -->
 
-  <p>Only support for <code>image/png</code> is required. User agents
-  may support other types. If the user agent does not support the
-  requested type, it must return the image using the PNG format.</p>
+  </ol><p>The <dfn id=dom-canvas-toblob title=dom-canvas-toBlob><code>toBlob()</code></dfn> method
+  must run the following steps:</p>
 
+  <ol><li><p>Let <var title="">callback</var> be the first
+   argument.</li>
+
+   <li><p>Let <var title="">arguments</var> be the second and
+   subsequent arguments to the method, if any.</li>
+
+   <li><p>Let <var title="">file</var> be <a href=#a-serialization-of-the-image-as-a-file>a serialization of the
+   image as a file</a>, using <var title="">arguments</var>.</li>
+
+   <li><p>Return, but continue running these steps
+   asynchronously.</li>
+
+   <li><p>If <var title="">callback</var> is null, abort these
+   steps.</li>
+
+   <li><p><a href=#queue-a-task>Queue a task</a> to invoke the
+   <code>FileCallback</code> <var title="">callback</var> with a
+   <code><a href=#blob>Blob</a></code> object representing <var title="">file</var> as
+   its argument. The <a href=#task-source>task source</a> for this task is the
+   <dfn id=canvas-blob-serialization-task-source>canvas blob serialization task source</dfn>. <a href=#refsFILESYSTEMAPI>[FILESYSTEMAPI]</a> <a href=#refsFILEAPI>[FILEAPI]</a> </li>
+
+  </ol><p>When a user agent is to create <dfn id=a-serialization-of-the-image-as-a-file>a serialization of the image
+  as a file</dfn>, optionally with some given <var title="">arguments</var>, it must create an image file in the format
+  given by the first value of <var title="">arguments</var>, or, if
+  there are no <var title="">arguments</var>, in the PNG format. <a href=#refsPNG>[PNG]</a></p>
+
+  <p>If <var title="">arguments</var> is not empty, the first value
+  must be interpreted as a <a href=#mime-type title="MIME type">MIME type</a>
+  giving the format to use. If the type has any parameters, it must be
+  treated as not supported.</p>
+
+  <p class=example>For example, the value "<code>image/png</code>" would
+  mean to generate a PNG image, the value "<code>image/jpeg</code>"
+  would mean to generate a JPEG image, and the value
+  "<code>image/svg+xml</code>" would mean to generate an SVG image
+  (which would probably require that the implementation actually keep
+  enough information to reliably render an SVG image from the canvas).</p>
+
+  <p>User agents must support PNG ("<code>image/png</code>"). User
+  agents may support other types. If the user agent does not support
+  the requested type, it must create the file using the PNG format. <a href=#refsPNG>[PNG]</a></p>
+
   <p>User agents must <a href=#converted-to-ascii-lowercase title="converted to ASCII
   lowercase">convert the provided type to ASCII lowercase</a>
-  before establishing if they support that type and before creating
-  the <a href=#data-protocol title="data protocol"><code title="">data:</code>
-  URL</a>.</p>
+  before establishing if they support that type.</p>
 
-  </div>
+  <p>For image types that do not support an alpha channel, the
+  serialized image must be the canvas image composited onto a solid
+  black background using the source-over operator.</p>
 
-  <p class=note>When trying to use types other than
-  <code>image/png</code>, authors can check if the image was really
-  returned in the requested format by checking to see if the returned
-  string starts with one of the exact strings "<code title="">data:image/png,</code>" or "<code title="">data:image/png;</code>". If it does, the image is PNG, and
-  thus the requested type was not supported. (The one exception to
-  this is if the canvas has either no height or no width, in which
-  case the result might simply be "<code title="">data:,</code>".)</p>
-
-  <div class=impl>
-
-  <p>If the method is invoked with the first argument giving a type
-  corresponding to one of the types given in the first column of the
-  following table, and the user agent supports that type, then the
+  <p>If the first argument in <var title="">arguments</var> gives a
+  type corresponding to one of the types given in the first column of
+  the following table, and the user agent supports that type, then the
   subsequent arguments, if any, must be treated as described in the
   second cell of that row.</p>
 
   </div>
 
-  <table><thead><tr><th> Type <th> Other arguments
-   <tbody><tr><td> image/jpeg
+  <table><thead><tr><th> Type <th> Other arguments <th> Reference
+   <tbody><tr><td> <code>image/jpeg</code>
      <td> The second argument<span class=impl>, if it</span> is a
      number in the range 0.0 to 1.0 inclusive<span class=impl>, must
      be</span> treated as the desired quality level. <span class=impl>If it is not a number or is outside that range, the
      user agent must use its default value, as if the argument had
      been omitted.</span>
+     <td> <a href=#refsJPEG>[JPEG]</a>
   </table><div class=impl>
 
   <p>For the purposes of these rules, an argument is considered to be
@@ -34143,14 +34184,10 @@
 
   <p>Other arguments must be ignored and must not cause the user agent
   to raise an exception. A future version of this specification will
-  probably define other parameters to be passed to <code title=dom-canvas-toDataURL><a href=#dom-canvas-todataurl>toDataURL()</a></code> to allow authors to
-  more carefully control compression settings, image metadata,
-  etc.</p>
+  probably define other parameters to be passed to these methods to
+  allow authors to more carefully control compression settings, image
+  metadata, etc.</p>
 
-  <!-- should we explicitly require the URL to be base64-encoded and
-  not have any parameters, to ensure the same exact URL is generated
-  in each browser? -->
-
   </div>
 
   <!--2DCONTEXT-->
@@ -38773,7 +38810,7 @@
   <p>In speech media, table cells can be distinguished by reporting
   the corresponding headers before reading the cell's contents, and by
   allowing users to navigate the table in a grid fashion, rather than
-  serialising the entire contents of the table in source order.</p>
+  serializing the entire contents of the table in source order.</p>
 
   <p>Authors are encouraged to use CSS to achieve these effects.</p>
 
@@ -98223,6 +98260,10 @@
    <dd><cite><a href=http://dev.w3.org/2006/webapi/FileUpload/publish/FileAPI.html>File
    API</a></cite>, A. Ranganathan. W3C.</dd>
 
+   <dt id=refsFILESYSTEMAPI>[FILESYSTEMAPI]</dt>
+   <dd><cite><a href=http://dev.w3.org/2009/dap/file-system/file-dir-sys.html>File
+   API: Directories and System</a></cite>, E. Uhrhane. W3C.</dd>
+
    <dt id=refsGBK>[GBK]</dt>
    <dd><cite>Chinese Internal Code Specification</cite>. Chinese IT
    Standardization Technical Committee.</dd>
@@ -98286,6 +98327,9 @@
    character sets — Part 11: Latin/Thai
    alphabet</a></cite>. ISO.</dd>
 
+   <dt id=refsJPEG>[JPEG]</dt>
+   <dd><cite><a href=http://www.w3.org/Graphics/JPEG/jfif3.pdf>JPEG File Interchange Format</a></cite>, E. Hamilton.</dd>
+
    <dt id=refsJSON>[JSON]</dt>
    <dd><cite><a href=http://tools.ietf.org/html/rfc4627>The
    application/json Media Type for JavaScript Object Notation
@@ -99029,6 +99073,7 @@
   Krzysztof Maczyński,
   黒澤剛志 (Kurosawa Takeshi),
   Kyle Hofmann<!-- Ozob -->,
+  Kyle Huey,
   Léonard Bouchet,
   Lachlan Hunt,
   Larry Masinter,

Modified: index
===================================================================
--- index	2011-05-12 19:51:30 UTC (rev 6133)
+++ index	2011-05-12 20:40:41 UTC (rev 6134)
@@ -33852,9 +33852,8 @@
            attribute unsigned long <a href=#dom-canvas-width title=dom-canvas-width>width</a>;
            attribute unsigned long <a href=#dom-canvas-height title=dom-canvas-height>height</a>;
 
-  DOMString <a href=#dom-canvas-todataurl title=dom-canvas-toDataURL>toDataURL</a>(in optional DOMString type, in any... args);<!--
-  v5:
-  void <span title="dom-canvas-toBlob">toBlob</span>(in <span>FileCallback</span>, in optional DOMString type, in any... args);-->
+  DOMString <a href=#dom-canvas-todataurl title=dom-canvas-toDataURL>toDataURL</a>(in optional DOMString type, in any... args);
+  void <a href=#dom-canvas-toblob title=dom-canvas-toBlob>toBlob</a>(in <span>FileCallback</span>, in optional DOMString type, in any... args);
 
   object <a href=#dom-canvas-getcontext title=dom-canvas-getContext>getContext</a>(in DOMString contextId, in any... args);
 };</pre>
@@ -34088,80 +34087,122 @@
     type, and control the way that the image is generated, as given in
     the table below.</p>
 
+    <p>When trying to use types other than "<code>image/png</code>",
+    authors can check if the image was really returned in the
+    requested format by checking to see if the returned string starts
+    with one of the exact strings "<code title="">data:image/png,</code>" or "<code title="">data:image/png;</code>". If it does, the image is PNG,
+    and thus the requested type was not supported. (The one exception
+    to this is if the canvas has either no height or no width, in
+    which case the result might simply be "<code title="">data:,</code>".)</p>
+
    </dd>
 
-   <!-- v5: toBlob -->
+   <dt><var title="">canvas</var> . <code title=dom-canvas-toBlob><a href=#dom-canvas-toblob>toBlob</a></code>(<var title="">callback</var> [, <var title="">type</var>, ... ])</dt>
 
+   <dd>
+
+    <p>Creates a <code><a href=#blob>Blob</a></code> object representing a file
+    containing the image in the canvas, and invokes a callback with a
+    handle to that object.</p>
+
+    <p>The second argument, if provided, controls the type of the
+    image to be returned (e.g. PNG or JPEG). The default is <code title="">image/png</code>; that type is also used if the given
+    type isn't supported. The other arguments are specific to the
+    type, and control the way that the image is generated, as given in
+    the table below.</p>
+
+   </dd>
+
   </dl><div class=impl>
 
   <p>The <dfn id=dom-canvas-todataurl title=dom-canvas-toDataURL><code>toDataURL()</code></dfn> method
-  must, when called with no arguments, return a <a href=#data-protocol title="data
-  protocol"><code title="">data:</code> URL</a> containing a
-  representation of the image as a PNG file. <a href=#refsPNG>[PNG]</a> <a href=#refsRFC2397>[RFC2397]</a></p>
+  must run the following steps:</p>
 
-<!--
-  v5:
-  void <span title="dom-canvas-toBlob">toBlob</span>(in <span>FileCallback</span>, in optional DOMString type, in any... args);
--->
+  <ol><li><p>If the canvas has no pixels (i.e. either its horizontal
+   dimension or its vertical dimension is zero) then return the string
+   "<code title="">data:,</code>" and abort these steps. (This is the
+   shortest <a href=#data-protocol title="data protocol"><code title="">data:</code>
+   URL</a>; it represents the empty string in a <code title="">text/plain</code> resource.)</li>
 
-  <p>If the canvas has no pixels (i.e. either its horizontal dimension
-  or its vertical dimension is zero) then the method must return the
-  string "<code title="">data:,</code>". (This is the shortest <a href=#data-protocol title="data protocol"><code title="">data:</code> URL</a>; it
-  represents the empty string in a <code title="">text/plain</code>
-  resource.)</p>
+   <li><p>Let <var title="">file</var> be <a href=#a-serialization-of-the-image-as-a-file>a serialization of the
+   image as a file</a>, using the method's arguments (if any) as
+   the <var title="">arguments</var>.</li>
 
-  <p>When the <code title=dom-canvas-toDataURL><a href=#dom-canvas-todataurl>toDataURL(<var title="">type</var>)</a></code> method is called with one <em>or
-  more</em> arguments, it must return a <a href=#data-protocol title="data
-  protocol"><code title="">data:</code> URL</a> containing a
-  representation of the image in the format given by <var title="">type</var>. The possible values are <a href=#mime-type title="MIME
-  type">MIME types</a> with no parameters, for example
-  <code>image/png</code>, <code>image/jpeg</code>, or even maybe
-  <code>image/svg+xml</code> if the implementation actually keeps
-  enough information to reliably render an SVG image from the
-  canvas.</p>
+   <li><p>Return a <a href=#data-protocol title="data protocol"><code title="">data:</code> URL</a> representing <var title="">file</var>. <a href=#refsRFC2397>[RFC2397]</a></p>
 
-  <p>For image types that do not support an alpha channel, the image
-  must be composited onto a solid black background using the
-  source-over operator, and the resulting image must be the one used
-  to create the <a href=#data-protocol title="data protocol"><code title="">data:</code> URL</a>.</p>
+   <!-- should we explicitly require the URL to be base64-encoded and
+   not have any parameters, to ensure the same exact URL is generated
+   in each browser? -->
 
-  <p>Only support for <code>image/png</code> is required. User agents
-  may support other types. If the user agent does not support the
-  requested type, it must return the image using the PNG format.</p>
+  </ol><p>The <dfn id=dom-canvas-toblob title=dom-canvas-toBlob><code>toBlob()</code></dfn> method
+  must run the following steps:</p>
 
+  <ol><li><p>Let <var title="">callback</var> be the first
+   argument.</li>
+
+   <li><p>Let <var title="">arguments</var> be the second and
+   subsequent arguments to the method, if any.</li>
+
+   <li><p>Let <var title="">file</var> be <a href=#a-serialization-of-the-image-as-a-file>a serialization of the
+   image as a file</a>, using <var title="">arguments</var>.</li>
+
+   <li><p>Return, but continue running these steps
+   asynchronously.</li>
+
+   <li><p>If <var title="">callback</var> is null, abort these
+   steps.</li>
+
+   <li><p><a href=#queue-a-task>Queue a task</a> to invoke the
+   <code>FileCallback</code> <var title="">callback</var> with a
+   <code><a href=#blob>Blob</a></code> object representing <var title="">file</var> as
+   its argument. The <a href=#task-source>task source</a> for this task is the
+   <dfn id=canvas-blob-serialization-task-source>canvas blob serialization task source</dfn>. <a href=#refsFILESYSTEMAPI>[FILESYSTEMAPI]</a> <a href=#refsFILEAPI>[FILEAPI]</a> </li>
+
+  </ol><p>When a user agent is to create <dfn id=a-serialization-of-the-image-as-a-file>a serialization of the image
+  as a file</dfn>, optionally with some given <var title="">arguments</var>, it must create an image file in the format
+  given by the first value of <var title="">arguments</var>, or, if
+  there are no <var title="">arguments</var>, in the PNG format. <a href=#refsPNG>[PNG]</a></p>
+
+  <p>If <var title="">arguments</var> is not empty, the first value
+  must be interpreted as a <a href=#mime-type title="MIME type">MIME type</a>
+  giving the format to use. If the type has any parameters, it must be
+  treated as not supported.</p>
+
+  <p class=example>For example, the value "<code>image/png</code>" would
+  mean to generate a PNG image, the value "<code>image/jpeg</code>"
+  would mean to generate a JPEG image, and the value
+  "<code>image/svg+xml</code>" would mean to generate an SVG image
+  (which would probably require that the implementation actually keep
+  enough information to reliably render an SVG image from the canvas).</p>
+
+  <p>User agents must support PNG ("<code>image/png</code>"). User
+  agents may support other types. If the user agent does not support
+  the requested type, it must create the file using the PNG format. <a href=#refsPNG>[PNG]</a></p>
+
   <p>User agents must <a href=#converted-to-ascii-lowercase title="converted to ASCII
   lowercase">convert the provided type to ASCII lowercase</a>
-  before establishing if they support that type and before creating
-  the <a href=#data-protocol title="data protocol"><code title="">data:</code>
-  URL</a>.</p>
+  before establishing if they support that type.</p>
 
-  </div>
+  <p>For image types that do not support an alpha channel, the
+  serialized image must be the canvas image composited onto a solid
+  black background using the source-over operator.</p>
 
-  <p class=note>When trying to use types other than
-  <code>image/png</code>, authors can check if the image was really
-  returned in the requested format by checking to see if the returned
-  string starts with one of the exact strings "<code title="">data:image/png,</code>" or "<code title="">data:image/png;</code>". If it does, the image is PNG, and
-  thus the requested type was not supported. (The one exception to
-  this is if the canvas has either no height or no width, in which
-  case the result might simply be "<code title="">data:,</code>".)</p>
-
-  <div class=impl>
-
-  <p>If the method is invoked with the first argument giving a type
-  corresponding to one of the types given in the first column of the
-  following table, and the user agent supports that type, then the
+  <p>If the first argument in <var title="">arguments</var> gives a
+  type corresponding to one of the types given in the first column of
+  the following table, and the user agent supports that type, then the
   subsequent arguments, if any, must be treated as described in the
   second cell of that row.</p>
 
   </div>
 
-  <table><thead><tr><th> Type <th> Other arguments
-   <tbody><tr><td> image/jpeg
+  <table><thead><tr><th> Type <th> Other arguments <th> Reference
+   <tbody><tr><td> <code>image/jpeg</code>
      <td> The second argument<span class=impl>, if it</span> is a
      number in the range 0.0 to 1.0 inclusive<span class=impl>, must
      be</span> treated as the desired quality level. <span class=impl>If it is not a number or is outside that range, the
      user agent must use its default value, as if the argument had
      been omitted.</span>
+     <td> <a href=#refsJPEG>[JPEG]</a>
   </table><div class=impl>
 
   <p>For the purposes of these rules, an argument is considered to be
@@ -34171,14 +34212,10 @@
 
   <p>Other arguments must be ignored and must not cause the user agent
   to raise an exception. A future version of this specification will
-  probably define other parameters to be passed to <code title=dom-canvas-toDataURL><a href=#dom-canvas-todataurl>toDataURL()</a></code> to allow authors to
-  more carefully control compression settings, image metadata,
-  etc.</p>
+  probably define other parameters to be passed to these methods to
+  allow authors to more carefully control compression settings, image
+  metadata, etc.</p>
 
-  <!-- should we explicitly require the URL to be base64-encoded and
-  not have any parameters, to ensure the same exact URL is generated
-  in each browser? -->
-
   </div>
 
   <!--2DCONTEXT-->
@@ -38801,7 +38838,7 @@
   <p>In speech media, table cells can be distinguished by reporting
   the corresponding headers before reading the cell's contents, and by
   allowing users to navigate the table in a grid fashion, rather than
-  serialising the entire contents of the table in source order.</p>
+  serializing the entire contents of the table in source order.</p>
 
   <p>Authors are encouraged to use CSS to achieve these effects.</p>
 
@@ -94345,6 +94382,10 @@
    <dd><cite><a href=http://dev.w3.org/2006/webapi/FileUpload/publish/FileAPI.html>File
    API</a></cite>, A. Ranganathan. W3C.</dd>
 
+   <dt id=refsFILESYSTEMAPI>[FILESYSTEMAPI]</dt>
+   <dd><cite><a href=http://dev.w3.org/2009/dap/file-system/file-dir-sys.html>File
+   API: Directories and System</a></cite>, E. Uhrhane. W3C.</dd>
+
    <dt id=refsGBK>[GBK]</dt>
    <dd><cite>Chinese Internal Code Specification</cite>. Chinese IT
    Standardization Technical Committee.</dd>
@@ -94408,6 +94449,9 @@
    character sets — Part 11: Latin/Thai
    alphabet</a></cite>. ISO.</dd>
 
+   <dt id=refsJPEG>[JPEG]</dt>
+   <dd><cite><a href=http://www.w3.org/Graphics/JPEG/jfif3.pdf>JPEG File Interchange Format</a></cite>, E. Hamilton.</dd>
+
    <dt id=refsJSON>[JSON]</dt>
    <dd><cite><a href=http://tools.ietf.org/html/rfc4627>The
    application/json Media Type for JavaScript Object Notation
@@ -95170,6 +95214,7 @@
   Krzysztof Maczyński,
   黒澤剛志 (Kurosawa Takeshi),
   Kyle Hofmann<!-- Ozob -->,
+  Kyle Huey,
   Léonard Bouchet,
   Lachlan Hunt,
   Larry Masinter,

Modified: source
===================================================================
--- source	2011-05-12 19:51:30 UTC (rev 6133)
+++ source	2011-05-12 20:40:41 UTC (rev 6134)
@@ -37299,9 +37299,8 @@
            attribute unsigned long <span title="dom-canvas-width">width</span>;
            attribute unsigned long <span title="dom-canvas-height">height</span>;
 
-  DOMString <span title="dom-canvas-toDataURL">toDataURL</span>(in optional DOMString type, in any... args);<!--
-  v5:
-  void <span title="dom-canvas-toBlob">toBlob</span>(in <span>FileCallback</span>, in optional DOMString type, in any... args);-->
+  DOMString <span title="dom-canvas-toDataURL">toDataURL</span>(in optional DOMString type, in any... args);
+  void <span title="dom-canvas-toBlob">toBlob</span>(in <span>FileCallback</span>, in optional DOMString type, in any... args);
 
   object <span title="dom-canvas-getContext">getContext</span>(in DOMString contextId, in any... args);
 };</pre>
@@ -37585,78 +37584,134 @@
     type, and control the way that the image is generated, as given in
     the table below.</p>
 
+    <p>When trying to use types other than "<code>image/png</code>",
+    authors can check if the image was really returned in the
+    requested format by checking to see if the returned string starts
+    with one of the exact strings "<code
+    title="">data:image/png,</code>" or "<code
+    title="">data:image/png;</code>". If it does, the image is PNG,
+    and thus the requested type was not supported. (The one exception
+    to this is if the canvas has either no height or no width, in
+    which case the result might simply be "<code
+    title="">data:,</code>".)</p>
+
    </dd>
 
-   <!-- v5: toBlob -->
+   <dt><var title="">canvas</var> . <code title="dom-canvas-toBlob">toBlob</code>(<var title="">callback</var> [, <var title="">type</var>, ... ])</dt>
 
+   <dd>
+
+    <p>Creates a <code>Blob</code> object representing a file
+    containing the image in the canvas, and invokes a callback with a
+    handle to that object.</p>
+
+    <p>The second argument, if provided, controls the type of the
+    image to be returned (e.g. PNG or JPEG). The default is <code
+    title="">image/png</code>; that type is also used if the given
+    type isn't supported. The other arguments are specific to the
+    type, and control the way that the image is generated, as given in
+    the table below.</p>
+
+   </dd>
+
   </dl>
 
   <div class="impl">
 
   <p>The <dfn
   title="dom-canvas-toDataURL"><code>toDataURL()</code></dfn> method
-  must, when called with no arguments, return a <span title="data
-  protocol"><code title="">data:</code> URL</span> containing a
-  representation of the image as a PNG file. <a
-  href="#refsPNG">[PNG]</a> <a href="#refsRFC2397">[RFC2397]</a></p>
+  must run the following steps:</p>
 
-<!--
-  v5:
-  void <span title="dom-canvas-toBlob">toBlob</span>(in <span>FileCallback</span>, in optional DOMString type, in any... args);
--->
+  <ol>
 
-  <p>If the canvas has no pixels (i.e. either its horizontal dimension
-  or its vertical dimension is zero) then the method must return the
-  string "<code title="">data:,</code>". (This is the shortest <span
-  title="data protocol"><code title="">data:</code> URL</span>; it
-  represents the empty string in a <code title="">text/plain</code>
-  resource.)</p>
+   <li><p>If the canvas has no pixels (i.e. either its horizontal
+   dimension or its vertical dimension is zero) then return the string
+   "<code title="">data:,</code>" and abort these steps. (This is the
+   shortest <span title="data protocol"><code title="">data:</code>
+   URL</span>; it represents the empty string in a <code
+   title="">text/plain</code> resource.)</p></li>
 
-  <p>When the <code title="dom-canvas-toDataURL">toDataURL(<var
-  title="">type</var>)</code> method is called with one <em>or
-  more</em> arguments, it must return a <span title="data
-  protocol"><code title="">data:</code> URL</span> containing a
-  representation of the image in the format given by <var
-  title="">type</var>. The possible values are <span title="MIME
-  type">MIME types</span> with no parameters, for example
-  <code>image/png</code>, <code>image/jpeg</code>, or even maybe
-  <code>image/svg+xml</code> if the implementation actually keeps
-  enough information to reliably render an SVG image from the
-  canvas.</p>
+   <li><p>Let <var title="">file</var> be <span>a serialization of the
+   image as a file</span>, using the method's arguments (if any) as
+   the <var title="">arguments</var>.</p></li>
 
-  <p>For image types that do not support an alpha channel, the image
-  must be composited onto a solid black background using the
-  source-over operator, and the resulting image must be the one used
-  to create the <span title="data protocol"><code
-  title="">data:</code> URL</span>.</p>
+   <li><p>Return a <span title="data protocol"><code
+   title="">data:</code> URL</span> representing <var
+   title="">file</var>. <a href="#refsRFC2397">[RFC2397]</a></p>
 
-  <p>Only support for <code>image/png</code> is required. User agents
-  may support other types. If the user agent does not support the
-  requested type, it must return the image using the PNG format.</p>
+   <!-- should we explicitly require the URL to be base64-encoded and
+   not have any parameters, to ensure the same exact URL is generated
+   in each browser? -->
 
+  </ol>
+
+  <p>The <dfn
+  title="dom-canvas-toBlob"><code>toBlob()</code></dfn> method
+  must run the following steps:</p>
+
+  <ol>
+
+   <li><p>Let <var title="">callback</var> be the first
+   argument.</p></li>
+
+   <li><p>Let <var title="">arguments</var> be the second and
+   subsequent arguments to the method, if any.</p></li>
+
+   <li><p>Let <var title="">file</var> be <span>a serialization of the
+   image as a file</span>, using <var
+   title="">arguments</var>.</p></li>
+
+   <li><p>Return, but continue running these steps
+   asynchronously.</p></li>
+
+   <li><p>If <var title="">callback</var> is null, abort these
+   steps.</p></li>
+
+   <li><p><span>Queue a task</span> to invoke the
+   <code>FileCallback</code> <var title="">callback</var> with a
+   <code>Blob</code> object representing <var title="">file</var> as
+   its argument. The <span>task source</span> for this task is the
+   <dfn>canvas blob serialization task source</dfn>. <a
+   href="#refsFILESYSTEMAPI">[FILESYSTEMAPI]</a> <a
+   href="#refsFILEAPI">[FILEAPI]</a> </p></li>
+
+  </ol>
+
+  <p>When a user agent is to create <dfn>a serialization of the image
+  as a file</dfn>, optionally with some given <var
+  title="">arguments</var>, it must create an image file in the format
+  given by the first value of <var title="">arguments</var>, or, if
+  there are no <var title="">arguments</var>, in the PNG format. <a
+  href="#refsPNG">[PNG]</a></p>
+
+  <p>If <var title="">arguments</var> is not empty, the first value
+  must be interpreted as a <span title="MIME type">MIME type</span>
+  giving the format to use. If the type has any parameters, it must be
+  treated as not supported.</p>
+
+  <p class="example">For example, the value "<code>image/png</code>" would
+  mean to generate a PNG image, the value "<code>image/jpeg</code>"
+  would mean to generate a JPEG image, and the value
+  "<code>image/svg+xml</code>" would mean to generate an SVG image
+  (which would probably require that the implementation actually keep
+  enough information to reliably render an SVG image from the canvas).</p>
+
+  <p>User agents must support PNG ("<code>image/png</code>"). User
+  agents may support other types. If the user agent does not support
+  the requested type, it must create the file using the PNG format. <a
+  href="#refsPNG">[PNG]</a></p>
+
   <p>User agents must <span title="converted to ASCII
   lowercase">convert the provided type to ASCII lowercase</span>
-  before establishing if they support that type and before creating
-  the <span title="data protocol"><code title="">data:</code>
-  URL</span>.</p>
+  before establishing if they support that type.</p>
 
-  </div>
+  <p>For image types that do not support an alpha channel, the
+  serialized image must be the canvas image composited onto a solid
+  black background using the source-over operator.</p>
 
-  <p class="note">When trying to use types other than
-  <code>image/png</code>, authors can check if the image was really
-  returned in the requested format by checking to see if the returned
-  string starts with one of the exact strings "<code
-  title="">data:image/png,</code>" or "<code
-  title="">data:image/png;</code>". If it does, the image is PNG, and
-  thus the requested type was not supported. (The one exception to
-  this is if the canvas has either no height or no width, in which
-  case the result might simply be "<code title="">data:,</code>".)</p>
-
-  <div class="impl">
-
-  <p>If the method is invoked with the first argument giving a type
-  corresponding to one of the types given in the first column of the
-  following table, and the user agent supports that type, then the
+  <p>If the first argument in <var title="">arguments</var> gives a
+  type corresponding to one of the types given in the first column of
+  the following table, and the user agent supports that type, then the
   subsequent arguments, if any, must be treated as described in the
   second cell of that row.</p>
 
@@ -37664,16 +37719,17 @@
 
   <table>
    <thead>
-    <tr> <th> Type <th> Other arguments
+    <tr> <th> Type <th> Other arguments <th> Reference
    <tbody>
     <tr>
-     <td> image/jpeg
+     <td> <code>image/jpeg</code>
      <td> The second argument<span class="impl">, if it</span> is a
      number in the range 0.0 to 1.0 inclusive<span class="impl">, must
      be</span> treated as the desired quality level. <span
      class="impl">If it is not a number or is outside that range, the
      user agent must use its default value, as if the argument had
      been omitted.</span>
+     <td> <a href="#refsJPEG">[JPEG]</a>
   </table>
 
   <div class="impl">
@@ -37685,15 +37741,10 @@
 
   <p>Other arguments must be ignored and must not cause the user agent
   to raise an exception. A future version of this specification will
-  probably define other parameters to be passed to <code
-  title="dom-canvas-toDataURL">toDataURL()</code> to allow authors to
-  more carefully control compression settings, image metadata,
-  etc.</p>
+  probably define other parameters to be passed to these methods to
+  allow authors to more carefully control compression settings, image
+  metadata, etc.</p>
 
-  <!-- should we explicitly require the URL to be base64-encoded and
-  not have any parameters, to ensure the same exact URL is generated
-  in each browser? -->
-
   </div>
 
   <!--END w3c-html--><!--2DCONTEXT-->
@@ -43148,7 +43199,7 @@
   <p>In speech media, table cells can be distinguished by reporting
   the corresponding headers before reading the cell's contents, and by
   allowing users to navigate the table in a grid fashion, rather than
-  serialising the entire contents of the table in source order.</p>
+  serializing the entire contents of the table in source order.</p>
 
   <p>Authors are encouraged to use CSS to achieve these effects.</p>
 
@@ -112064,6 +112115,11 @@
    href="http://dev.w3.org/2006/webapi/FileUpload/publish/FileAPI.html">File
    API</a></cite>, A. Ranganathan. W3C.</dd>
 
+   <dt id="refsFILESYSTEMAPI">[FILESYSTEMAPI]</dt>
+   <dd><cite><a
+   href="http://dev.w3.org/2009/dap/file-system/file-dir-sys.html">File
+   API: Directories and System</a></cite>, E. Uhrhane. W3C.</dd>
+
    <dt id="refsGBK">[GBK]</dt>
    <dd><cite>Chinese Internal Code Specification</cite>. Chinese IT
    Standardization Technical Committee.</dd>
@@ -112166,6 +112222,9 @@
    character sets — Part 11: Latin/Thai
    alphabet</a></cite>. ISO.</dd>
 
+   <dt id="refsJPEG">[JPEG]</dt>
+   <dd><cite><a href="http://www.w3.org/Graphics/JPEG/jfif3.pdf">JPEG File Interchange Format</a></cite>, E. Hamilton.</dd>
+
    <dt id="refsJSON">[JSON]</dt>
    <dd><cite><a href="http://tools.ietf.org/html/rfc4627">The
    application/json Media Type for JavaScript Object Notation
@@ -113047,6 +113106,7 @@
   Krzysztof Maczy&#x0144;ski,
   &#x9ed2;&#x6fa4;&#x525b;&#x5fd7; (Kurosawa Takeshi),
   Kyle Hofmann<!-- Ozob -->,
+  Kyle Huey,
   Léonard Bouchet,
   Lachlan Hunt,
   Larry Masinter,




More information about the Commit-Watchers mailing list