public class

ImageDecodeOptionsBuilder

extends Object
java.lang.Object
   ↳ com.facebook.imagepipeline.common.ImageDecodeOptionsBuilder<T extends com.facebook.imagepipeline.common.ImageDecodeOptionsBuilder>

Class Overview

Builder for ImageDecodeOptions.

Summary

Public Constructors
ImageDecodeOptionsBuilder()
Public Methods
ImageDecodeOptions build()
Builds the immutable ImageDecodeOptions instance.
Bitmap.Config getBitmapConfig()
Gets which config image will be decode with;
BitmapTransformation getBitmapTransformation()
ColorSpace getColorSpace()
Gets the target color space for decoding.
ImageDecoder getCustomImageDecoder()
Get the custom image decoder, if one has been set.
boolean getDecodeAllFrames()
Gets whether to decode all the frames and store them in memory.
boolean getDecodePreviewFrame()
Gets whether to decode a preview frame for animated images.
boolean getExcludeBitmapConfigFromComparison()
boolean getForceStaticImage()
Gets whether to force animated image formats to be decoded as static, non-animated images.
int getMaxDimensionPx()
Gets the maximum image dimension (width or height).
int getMinDecodeIntervalMs()
Gets the minimum decode interval.
boolean getUseLastFrameForPreview()
Gets whether to use the last frame for the preview image (defaults to the first frame).
T setBitmapConfig(Bitmap.Config bitmapConfig)
Sets which config static image will be decode with;
T setBitmapTransformation(BitmapTransformation bitmapTransformation)
Set a custom in-place bitmap transformation that is applied immediately after decoding.
T setColorSpace(ColorSpace colorSpace)
Sets the target color space for decoding.
T setCustomImageDecoder(ImageDecoder customImageDecoder)
Set a custom image decoder override to be used for the given image.
T setDecodeAllFrames(boolean decodeAllFrames)
Sets whether to decode all the frames and store them in memory.
T setDecodePreviewFrame(boolean decodePreviewFrame)
Sets whether to decode a preview frame for animated images.
T setExcludeBitmapConfigFromComparison(boolean excludeBitmapConfigFromComparison)
T setForceStaticImage(boolean forceStaticImage)
Sets whether to force animated image formats to be decoded as static, non-animated images.
ImageDecodeOptionsBuilder setFrom(ImageDecodeOptions options)
Sets the builder to be equivalent to the specified options.
T setMaxDimensionPx(int maxDimensionPx)
Sets the maximum image dimension (width or height).
T setMinDecodeIntervalMs(int intervalMs)
Sets the minimum decode interval.
T setUseLastFrameForPreview(boolean useLastFrameForPreview)
Sets whether to use the last frame for the preview image (defaults to the first frame).
Protected Methods
T getThis()
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ImageDecodeOptionsBuilder ()

Public Methods

public ImageDecodeOptions build ()

Builds the immutable ImageDecodeOptions instance.

Returns
  • the immutable instance

public Bitmap.Config getBitmapConfig ()

Gets which config image will be decode with;

Returns
  • which config image will be decode with

public BitmapTransformation getBitmapTransformation ()

public ColorSpace getColorSpace ()

Gets the target color space for decoding.

Returns
  • the target color space.

public ImageDecoder getCustomImageDecoder ()

Get the custom image decoder, if one has been set.

Returns
  • the custom image decoder or null if not set

public boolean getDecodeAllFrames ()

Gets whether to decode all the frames and store them in memory. This should only ever be used for animations that are known to be small (e.g. stickers). Caching dozens of large Bitmaps in memory for general GIFs or WebP's will not fit in memory.

Returns
  • whether to decode all the frames and store them in memory

public boolean getDecodePreviewFrame ()

Gets whether to decode a preview frame for animated images.

Returns
  • whether to decode a preview frame

public boolean getExcludeBitmapConfigFromComparison ()

public boolean getForceStaticImage ()

Gets whether to force animated image formats to be decoded as static, non-animated images.

Returns
  • whether to force animated image formats to be decoded as static

public int getMaxDimensionPx ()

Gets the maximum image dimension (width or height).

Returns
  • the maxinum image dimension in pixels

public int getMinDecodeIntervalMs ()

Gets the minimum decode interval.

Returns
  • the minimum decode interval in milliseconds

public boolean getUseLastFrameForPreview ()

Gets whether to use the last frame for the preview image (defaults to the first frame).

Returns
  • whether to use the last frame for the preview image

public T setBitmapConfig (Bitmap.Config bitmapConfig)

Sets which config static image will be decode with;

Parameters
bitmapConfig which config static image will be decode with;

public T setBitmapTransformation (BitmapTransformation bitmapTransformation)

Set a custom in-place bitmap transformation that is applied immediately after decoding.

Parameters
bitmapTransformation the transformation to use
Returns
  • the builder

public T setColorSpace (ColorSpace colorSpace)

Sets the target color space for decoding. When possible, the color space transformation will be performed at load time. This requires SDK version >= 26, otherwise it's a no-op.

Parameters
colorSpace target color space for decoding.

public T setCustomImageDecoder (ImageDecoder customImageDecoder)

Set a custom image decoder override to be used for the given image. This will bypass all default decoders and only use the provided custom image decoder for the given image.

Parameters
customImageDecoder the custom decoder to use
Returns
  • this builder

public T setDecodeAllFrames (boolean decodeAllFrames)

Sets whether to decode all the frames and store them in memory. This should only ever be used for animations that are known to be small (e.g. stickers). Caching dozens of large Bitmaps in memory for general GIFs or WebP's will not fit in memory.

Parameters
decodeAllFrames whether to decode all the frames and store them in memory
Returns
  • this builder

public T setDecodePreviewFrame (boolean decodePreviewFrame)

Sets whether to decode a preview frame for animated images.

Parameters
decodePreviewFrame whether to decode a preview frame
Returns
  • this builder

public T setExcludeBitmapConfigFromComparison (boolean excludeBitmapConfigFromComparison)

public T setForceStaticImage (boolean forceStaticImage)

Sets whether to force animated image formats to be decoded as static, non-animated images.

Parameters
forceStaticImage whether to force the image to be decoded as a static image
Returns
  • this builder

public ImageDecodeOptionsBuilder setFrom (ImageDecodeOptions options)

Sets the builder to be equivalent to the specified options.

Parameters
options the options to copy from
Returns
  • this builder

public T setMaxDimensionPx (int maxDimensionPx)

Sets the maximum image dimension (width or height).

Parameters
maxDimensionPx the maximum image dimension in pixels
Returns
  • this builder

public T setMinDecodeIntervalMs (int intervalMs)

Sets the minimum decode interval.

Decoding of intermediate results won't happen more often that intervalMs. If another intermediate result comes too soon, it will be decoded only after intervalMs since the last decode. If there were more intermediate results in between, only the last one gets decoded.

Parameters
intervalMs the minimum decode interval in milliseconds
Returns
  • this builder

public T setUseLastFrameForPreview (boolean useLastFrameForPreview)

Sets whether to use the last frame for the preview image (defaults to the first frame).

Parameters
useLastFrameForPreview whether to use the last frame for the preview image
Returns
  • this builder

Protected Methods

protected T getThis ()