diff --git a/source b/source index 68eea5ec21f..08dab25a664 100644 --- a/source +++ b/source @@ -89418,10 +89418,20 @@ typedef (HTMLImageElement or CanvasRenderingContext2D or ImageBitmap) ImageBitmapSource; +enum ImageOrientation { "none", "flipY" }; +enum PremultiplyAlpha { "none", "premultiply", "default" }; +enum ColorspaceConversion { "none", "default" }; + +dictionary ImageBitmapOptions { + ImageOrientation imageOrientation = "none"; + PremultiplyAlpha premultiplyAlpha = "default"; + ColorspaceConversion colorspaceConversion = "default"; +}; + [NoInterfaceObject, Exposed=(Window,Worker)] interface ImageBitmapFactories { - Promise<ImageBitmap> createImageBitmap(ImageBitmapSource image); - Promise<ImageBitmap> createImageBitmap(ImageBitmapSource image, long sx, long sy, long sw, long sh); + Promise<ImageBitmap> createImageBitmap(ImageBitmapSource image, optional ImageBitmapOptions options); + Promise<ImageBitmap> createImageBitmap(ImageBitmapSource image, long sx, long sy, long sw, long sh, optional ImageBitmapOptions options); }; Window implements ImageBitmapFactories; WorkerGlobalScope implements ImageBitmapFactories; @@ -89436,7 +89446,8 @@ interface ImageBitmapFactories {
createImageBitmap
(image [, sx, sy, sw, sh ] )createImageBitmap
(image [, options ])createImageBitmap
(image, sx, sy, sw, sh [, options ])If options is provided, the ImageBitmap
object's bitmap
+ data is modified according to options. For example,
+ if the premultiplyAlpha
+ option is set to "premultiply
",
+ the bitmap data's color channels are
+ premultiplied by its alpha channel.
+
Rejects the promise with an InvalidStateError
exception if the source image is
not in a valid state (e.g. an img
element that hasn't finished loading, or a
CanvasRenderingContext2D
object whose bitmap data has zero length along one or
@@ -89549,8 +89567,8 @@ interface ImageBitmapFactories {
Let the ImageBitmap
object's bitmap data be a copy of the img
- element's media data, cropped to the source rectangle. If this is an animated
- image, the ImageBitmap
object's cropped to the source rectangle with formatting. If this is
+ an animated image, the ImageBitmap
object's bitmap data must only be taken from the
default image of the animation (the one that the format defines is to be used when animation
is not supported or is disabled), or, if there is no such image, the first frame of the
@@ -89597,7 +89615,7 @@ interface ImageBitmapFactories {
current playback position, at the media resource's intrinsic width and intrinsic height (i.e. after any aspect-ratio
- correction has been applied), cropped to the source rectangle.
If the origin of the video
element is not the same
origin as the origin specified by the entry settings object,
@@ -89632,7 +89650,7 @@ interface ImageBitmapFactories {
data-x="concept-ImageBitmap-bitmap-data">bitmap data be a copy of the
canvas
element's bitmap data, cropped to the source
- rectangle.
Set the origin-clean flag of the
Let the Let the Return a new promise, but continue running these steps
in parallel. Let the ImageBitmap
object's bitmap to the same value as the ImageBitmapFactories {
ImageBitmap
object's bitmap data be the image data read from the
- Blob
object, cropped to the source rectangle. If this is an animated
- image, the ImageBitmap
object's Blob object, cropped to the source rectangle with formatting.
+ If this is an animated image, the ImageBitmap
object's bitmap data must only be taken from the
default image of the animation (the one that the format defines is to be used when animation
is not supported or is disabled), or, if there is no such image, the first frame of the
@@ -89712,7 +89730,7 @@ interface ImageBitmapFactories {
ImageBitmap
object's bitmap data be the image data given by the
- ImageData
object, cropped to the source rectangle.ImageData
object, cropped to the source rectangle with formatting.ImageBitmap
object's bitmap data be a copy of the
CanvasRenderingContext2D
object's scratch bitmap, cropped to
- the source rectangle.
Set the origin-clean flag of the
Let the ImageBitmap
object's bitmap to the same value as the ImageBitmapFactories {
ImageBitmap
object's bitmap data be a copy of the image
argument's bitmap data, cropped
- to the source rectangle.
Set the origin-clean flag of the
ImageBitmap
object's bitmap to the same value as the ImageBitmapFactories {
When the steps above require that the user agent crop bitmap data to the source rectangle, the user agent must run the following - steps:
+ rectangle with formatting">crop bitmap data to the source rectangle with formatting, + the user agent must run the following steps:If the value of the imageOrientation
member of
+ options is "none
",
+ no extra step is required. If it is "flipY
", output must be flipped
+ vertically, disregarding any image orientation metadata of the source (such as EXIF metadata),
+ if any.
If the value of the colorspaceConversion
member of
+ options is "default
",
+ the colorspace conversion behavior is implementation-specific, and should be chosen according
+ to the colorspace that the implementation uses for drawing images onto the canvas. If it is
+ "none
", output must
+ be decoded without performing any colorspace conversions. This means that the image decoding
+ algorithm must ignore color profile metadata embedded in the source data as well as the display
+ device color profile.
+ colorspaceConversion
+ only applies when creating an ImageBitmap
object from bitmap media
+ data such as a Blob
object or an img
element with non-vector images.
The native colorspace of canvas is currently unspecified, but this is expected + to change in the future.
+ +If the value of the premultiplyAlpha
member of
+ options is "default
",
+ the alpha premultiplication behavior is implementation-specific, and should be chosen according
+ to implementation deems optimal for drawing images onto the canvas. If it is
+ "premultiply
", the
+ output that is not premultiplied by alpha must have its color components multiplied
+ by alpha and that is premultiplied by alpha must be left untouched. If it is
+ "none
", the output that is
+ not premultiplied by alpha must be left untouched and that is premultiplied by alpha
+ must have its color components divided by alpha.
Return output.