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 {
-
promise = Window . createImageBitmap(image [, sx, sy, sw, sh ] )
+
promise = Window . createImageBitmap(image [, options ])
+
promise = Window . createImageBitmap(image, sx, sy, sw, sh [, options ])
@@ -89453,6 +89464,13 @@ interface ImageBitmapFactories { any pixels missing in the original replaced by transparent black. These coordinates are in the source image's pixel coordinate space, not in CSS pixels.

+

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.

    + correction has been applied), cropped to the source rectangle with formatting.

  • 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.

  • + rectangle with formatting.

  • Set the origin-clean flag of the ImageBitmap object's bitmap to the same value as the ImageBitmapFactories {

  • Let the 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 {

  • Let the 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.

  • Return a new promise, but continue running these steps in parallel.

  • @@ -89741,7 +89759,7 @@ interface ImageBitmapFactories {
  • Let the ImageBitmap object's bitmap data be a copy of the CanvasRenderingContext2D object's scratch bitmap, cropped to - the source rectangle.

  • + the source rectangle with formatting.

  • Set the origin-clean flag of the ImageBitmap object's bitmap to the same value as the ImageBitmapFactories {

  • Let the ImageBitmap object's bitmap data be a copy of the image argument's bitmap data, cropped - to the source rectangle.

  • + to the source rectangle with formatting.

  • 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:

      @@ -89826,6 +89844,46 @@ interface ImageBitmapFactories { +
    1. 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.

    2. + +
    3. + +

      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.

      + +
    4. + +
    5. 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.

    6. +
    7. Return output.

    @@ -115846,6 +115904,9 @@ INSERT INTERFACES HERE
    [ENCODING]
    Encoding, A. van Kesteren, J. Bell. WHATWG.
    +
    [EXIF]
    +
    (Non-normative) Exchangeable image file format. JEITA.
    +
    [FETCH]
    Fetch, A. van Kesteren. WHATWG.
    @@ -116926,6 +116987,7 @@ INSERT INTERFACES HERE Wolfram Kriesing, Xan Gregg, xenotheme, + Xida Chen, Yang Chen, Ye-Kui Wang, Yehuda Katz,