From b799322188cf33c7caef336bb27fe9223d995b24 Mon Sep 17 00:00:00 2001
From: Donovan Glover Let file be a
serialization of this canvas
element's bitmap as a file, passing
- type and quality if they were given.
If file is null then return "data:,
".
If result is non-null, then set result to a serialization of result as a file, - with type and quality if they were given.
Queue a task to run these steps:
@@ -65294,7 +65294,7 @@ dictionary ImageBitmapRenderingContextSettings { dictionary ImageEncodeOptions { DOMString type = "image/png"; - unrestricted double quality = 1.0; + unrestricted double quality; }; enum OffscreenRenderingContextId { "2d", "webgl", "webgl2" }; @@ -65612,7 +65612,7 @@ interface OffscreenCanvas : EventTarget {Let file be a
serialization of bitmap as a file, with options's type
and quality
.
Queue a task to run these steps:
@@ -65892,11 +65892,10 @@ interface OffscreenCanvasRenderingContext2D {When a user agent is to create a - serialization of the bitmap as a file, given an optional type and - quality, it must create an image file in the format given by type, or if - type was not supplied, in the PNG format. If an error occurs during the creation of - the image file (e.g. an internal encoder error), then the result of the serialization is null. -
+ serialization of the bitmap as a file, given a type and an optional + quality, it must create an image file in the format given by type. If an + error occurs during the creation of the image file (e.g. an internal encoder error), then the + result of the serialization is null.The image file's pixel data must be the bitmap's pixel data scaled to one image pixel per coordinate space unit, and if the file format used supports encoding resolution metadata, the @@ -65923,16 +65922,20 @@ interface OffscreenCanvasRenderingContext2D { image composited onto an opaque black background using the source-over operator.
If type is an image format that supports variable quality (such as
- "image/jpeg
") and quality is given, then, if Type(quality) is Number, and quality is in the range
- 0.0 to 1.0 inclusive, the user agent must treat quality as the desired quality level.
- If Type(quality) is not Number, or if quality
- is outside that range, the user agent must use its default quality value, as if the
- quality argument had not been given.
image/jpeg
"), quality is given, and type is not
+ "image/png
", then, if Type(quality) is
+ Number, and quality is in the range 0.0 to 1.0 inclusive, the user agent must treat
+ quality as the desired quality level. Otherwise, the user agent must use its default
+ quality value, as if the quality argument had not been given.
The use of type-testing here, instead of simply declaring quality as
a Web IDL double
, is a historical artifact.
Different implementations can have slightly different interpretations of + "quality". When the quality is not specified, an implementation-specific default is used that + represents a reasonable compromise between compression ratio, image quality, and encoding + time.
+