@@ -59562,8 +59562,8 @@ interface <dfn>HTMLCanvasElement</dfn> : <span>HTMLElement</span> {
59562
59562
59563
59563
<span>RenderingContext</span>? <span data-x="dom-canvas-getContext">getContext</span>(DOMString contextId, optional any options = null);
59564
59564
59565
- USVString <span data-x="dom-canvas-toDataURL">toDataURL</span>(optional DOMString type, optional any quality);
59566
- void <span data-x="dom-canvas-toBlob">toBlob</span>(<span>BlobCallback</span> _callback, optional DOMString type, optional any quality);
59565
+ USVString <span data-x="dom-canvas-toDataURL">toDataURL</span>(optional DOMString type = "image/png" , optional any quality);
59566
+ void <span data-x="dom-canvas-toBlob">toBlob</span>(<span>BlobCallback</span> _callback, optional DOMString type = "image/png" , optional any quality);
59567
59567
<span>OffscreenCanvas</span> <span data-x="dom-canvas-transferControlToOffscreen">transferControlToOffscreen</span>();
59568
59568
};
59569
59569
@@ -59961,7 +59961,7 @@ callback <dfn>BlobCallback</dfn> = void (<span>Blob</span>? blob);</code></pre>
59961
59961
59962
59962
<li><p>Let <var>file</var> be <span data-x="a serialization of the bitmap as a file">a
59963
59963
serialization of this <code>canvas</code> element's bitmap as a file</span>, passing
59964
- <var>type</var> and <var>quality</var> if they were given.</p></li>
59964
+ <var>type</var> and <var>quality</var> if given.</p></li>
59965
59965
59966
59966
<li><p>If <var>file</var> is null then return "<code data-x="">data:,</code>".</p></li>
59967
59967
@@ -59992,8 +59992,8 @@ callback <dfn>BlobCallback</dfn> = void (<span>Blob</span>? blob);</code></pre>
59992
59992
59993
59993
<ol>
59994
59994
<li><p>If <var>result</var> is non-null, then set <var>result</var> to <span data-x="a
59995
- serialization of the bitmap as a file">a serialization of <var>result</var> as a file</span>,
59996
- with <var>type</var> and <var>quality</var> if they were given.</p></li>
59995
+ serialization of the bitmap as a file">a serialization of <var>result</var> as a file</span>
59996
+ with <var>type</var> and <var>quality</var> if given.</p></li>
59997
59997
59998
59998
<li>
59999
59999
<p><span>Queue a task</span> to run these steps:</p>
@@ -65294,7 +65294,7 @@ dictionary <dfn>ImageBitmapRenderingContextSettings</dfn> {
65294
65294
65295
65295
dictionary <dfn>ImageEncodeOptions</dfn> {
65296
65296
DOMString <span data-x="image-encode-options-type">type</span> = "image/png";
65297
- unrestricted double <span data-x="image-encode-options-quality">quality</span> = 1.0 ;
65297
+ unrestricted double <span data-x="image-encode-options-quality">quality</span>;
65298
65298
};
65299
65299
65300
65300
enum <dfn>OffscreenRenderingContextId</dfn> { "<span data-x="offscreen-context-type-2d">2d</span>", "<span data-x="offscreen-context-type-webgl">webgl</span>", "<span data-x="offscreen-context-type-webgl2">webgl2</span>" };
@@ -65612,7 +65612,7 @@ interface <dfn>OffscreenCanvas</dfn> : <span>EventTarget</span> {
65612
65612
<li><p>Let <var>file</var> be <span data-x="a serialization of the bitmap as a file">a
65613
65613
serialization of <var>bitmap</var> as a file</span>, with <var>options</var>'s <dfn><code
65614
65614
data-x="image-encode-options-type">type</code></dfn> and <dfn><code
65615
- data-x="image-encode-options-quality">quality</code></dfn>.</p></li>
65615
+ data-x="image-encode-options-quality">quality</code></dfn> if present .</p></li>
65616
65616
65617
65617
<li>
65618
65618
<p><span>Queue a task</span> to run these steps:</p>
@@ -65892,11 +65892,10 @@ interface <dfn>OffscreenCanvasRenderingContext2D</dfn> {
65892
65892
<div w-nodev>
65893
65893
65894
65894
<p>When a user agent is to create <!--en-GB--><dfn id="a-serialisation-of-the-bitmap-as-a-file">a
65895
- serialization of the bitmap as a file</dfn>, given an optional <var>type</var> and
65896
- <var>quality</var>, it must create an image file in the format given by <var>type</var>, or if
65897
- <var>type</var> was not supplied, in the PNG format. If an error occurs during the creation of
65898
- the image file (e.g. an internal encoder error), then the result of the serialization is null.
65899
- <ref spec=PNG></p>
65895
+ serialization of the bitmap as a file</dfn>, given a <var>type</var> and an optional
65896
+ <var>quality</var>, it must create an image file in the format given by <var>type</var>. If an
65897
+ error occurs during the creation of the image file (e.g. an internal encoder error), then the
65898
+ result of the serialization is null. <ref spec=PNG></p>
65900
65899
65901
65900
<p>The image file's pixel data must be the bitmap's pixel data scaled to one image pixel per
65902
65901
coordinate space unit, and if the file format used supports encoding resolution metadata, the
@@ -65923,16 +65922,20 @@ interface <dfn>OffscreenCanvasRenderingContext2D</dfn> {
65923
65922
image composited onto an <span>opaque black</span> background using the source-over operator.</p>
65924
65923
65925
65924
<p>If <var>type</var> is an image format that supports variable quality (such as
65926
- "<code>image/jpeg</code>") and <var>quality</var> is given, then, if <span
65927
- data-x="js-Type">Type</span>(<var>quality</var>) is Number, and <var>quality</var> is in the range
65928
- 0.0 to 1.0 inclusive, the user agent must treat <var>quality</var> as the desired quality level.
65929
- If <span data-x="js-Type">Type</span>(<var>quality</var>) is not Number, or if <var>quality</var>
65930
- is outside that range, the user agent must use its default quality value, as if the
65931
- <var>quality</var> argument had not been given.</p>
65925
+ "<code>image/jpeg</code>"), <var>quality</var> is given, and <var>type</var> is not
65926
+ "<code>image/png</code>", then, if <span data-x="js-Type">Type</span>(<var>quality</var>) is
65927
+ Number, and <var>quality</var> is in the range 0.0 to 1.0 inclusive, the user agent must treat
65928
+ <var>quality</var> as the desired quality level. Otherwise, the user agent must use its default
65929
+ quality value, as if the <var>quality</var> argument had not been given.</p>
65932
65930
65933
65931
<p class="note">The use of type-testing here, instead of simply declaring <var>quality</var> as
65934
65932
a Web IDL <code data-x="">double</code>, is a historical artifact.</p>
65935
65933
65934
+ <p class="note">Different implementations can have slightly different interpretations of
65935
+ "quality". When the quality is not specified, an implementation-specific default is used that
65936
+ represents a reasonable compromise between compression ratio, image quality, and encoding
65937
+ time.</p>
65938
+
65936
65939
</div>
65937
65940
65938
65941
0 commit comments