chromium/third_party/blink/renderer/modules/webcodecs/image_decoder_init.idl

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// https://github.com/WICG/web-codecs

typedef ([AllowShared] ArrayBuffer or [AllowShared] ArrayBufferView or ReadableStream) ImageBufferSource;
dictionary ImageDecoderInit {
  required ImageBufferSource data;

  // Mime type for |data|. Providing the wrong mime type will lead to a decoding
  // failure.
  required USVString type;

  // Options used for setting up the decoder. See ImageBitmapOptions.
  ColorSpaceConversion colorSpaceConversion = "default";

  // Some image decoders support reduced resolution decoding. The desired size
  // can optionally be provided to trigger this behavior.
  [EnforceRange] unsigned long desiredWidth;
  [EnforceRange] unsigned long desiredHeight;

  // For multi-track images, indicates that the animation is preferred over any
  // still images that are present. When unspecified the decoder will use hints
  // from the data stream to make a decision.
  boolean preferAnimation;

  // Allows transferring ArrayBuffer based `data` to ImageDecoder w/o a copy.
  sequence<ArrayBuffer> transfer = [];
};