Class BitmapFactory.Options

java.lang.Object
icyllis.modernui.graphics.BitmapFactory.Options
Enclosing class:
BitmapFactory

public static class BitmapFactory.Options extends Object
Collects the options for the decoder and additional outputs from the decoder.

Unlike Android (with its Skia graphics engine), it is not necessary to pre-multiply alpha of image data in Modern UI framework. We allow images to be directly drawn by the view system or through a Canvas either pre-multiplied or non-pre-multiplied. Although pre-multiplied alpha can help draw-time blending, but it results in precision loss since images are 8-bit per channel in memory. Instead, Modern UI will pre-multiply alpha in the shading pipeline.

  • Field Details

    • inImmutable

      public boolean inImmutable
      If false, decode methods will always return a mutable Bitmap instead of an immutable one. This can be used for instance to programmatically apply effects to a Bitmap loaded through BitmapFactory.
    • inDecodeMimeType

      public boolean inDecodeMimeType
      If set to true, the decoder will populate the mimetype of the decoded image.
      See Also:
    • inPreferredFormat

      public Bitmap.Format inPreferredFormat
      If this is non-null, the decoder will try to decode into this internal format. If it is null, or the request cannot be met, the decoder will try to pick the best matching format based on the system's screen depth, and characteristics of the original image such as if it has per-pixel alpha (requiring a format that also does).
    • inPreferredColorSpace

      public ColorSpace inPreferredColorSpace
      If this is non-null, the decoder will try to decode into this color space. If it is null, or the request cannot be met, the decoder will pick either the color space embedded in the image or the color space best suited for the requested image format (for instance sRGB for Bitmap.Format.RGBA_8888 format.

      Only ColorSpace.Model.RGB color spaces are currently supported. An IllegalArgumentException will be thrown by the decode methods when setting a non-RGB color space such as Lab.

      The specified color space's transfer function must be an ICC parametric curve. An IllegalArgumentException will be thrown by the decode methods if calling ColorSpace.Rgb.getTransferParameters() on the specified color space returns null.

      After decode, the bitmap's color space is stored in outColorSpace.

    • outWidth

      public int outWidth
      The width of the bitmap. If there is an error, it is undefined.
    • outHeight

      public int outHeight
      The height of the bitmap. If there is an error, it is undefined.
    • outMimeType

      public String outMimeType
      If known, this string is set to the mimetype of the decoded image. If not known, or there is an error, it is undefined.

      Set only when inDecodeMimeType is true.

    • outFormat

      public Bitmap.Format outFormat
      If known, the config the decoded bitmap will have. If not known, or there is an error, it is undefined.
    • outColorSpace

      public ColorSpace outColorSpace
      If known, the color space the decoded bitmap will have. Note that the output color space is not guaranteed to be the color space the bitmap is encoded with. If not known, or there is an error, it is undefined.
  • Constructor Details

    • Options

      public Options()