-
public class ImageDecodeOptionsBuilder<T extends ImageDecodeOptionsBuilder>Builder for ImageDecodeOptions.
-
-
Constructor Summary
Constructors Constructor Description ImageDecodeOptionsBuilder()
-
Method Summary
Modifier and Type Method Description ImageDecodeOptionsBuildersetFrom(ImageDecodeOptions options)Sets the builder to be equivalent to the specified options. TsetMinDecodeIntervalMs(int intervalMs)Sets the minimum decode interval. intgetMinDecodeIntervalMs()Gets the minimum decode interval. TsetMaxDimensionPx(int maxDimensionPx)Sets the maximum image dimension (width or height). intgetMaxDimensionPx()Gets the maximum image dimension (width or height). TsetDecodePreviewFrame(boolean decodePreviewFrame)Sets whether to decode a preview frame for animated images. booleangetDecodePreviewFrame()Gets whether to decode a preview frame for animated images. booleangetUseLastFrameForPreview()Gets whether to use the last frame for the preview image (defaults to the first frame). TsetUseLastFrameForPreview(boolean useLastFrameForPreview)Sets whether to use the last frame for the preview image (defaults to the first frame). booleangetDecodeAllFrames()Gets whether to decode all the frames and store them in memory. TsetDecodeAllFrames(boolean decodeAllFrames)Sets whether to decode all the frames and store them in memory. TsetForceStaticImage(boolean forceStaticImage)Sets whether to force animated image formats to be decoded as static, non-animated images. TsetCustomImageDecoder(@Nullable() ImageDecoder customImageDecoder)Set a custom image decoder override to be used for the given image. ImageDecodergetCustomImageDecoder()Get the custom image decoder, if one has been set. booleangetForceStaticImage()Gets whether to force animated image formats to be decoded as static, non-animated images. Bitmap.ConfiggetBitmapConfig()Gets which config image will be decode with; TsetBitmapConfig(Bitmap.Config bitmapConfig)Sets which config static image will be decode with; Bitmap.ConfiggetAnimatedBitmapConfig()Gets which config the animated image will be decode with; TsetAnimatedBitmapConfig(Bitmap.Config animatedBitmapConfig)Sets which config the animated image will be decode with; TsetBitmapTransformation(@Nullable() BitmapTransformation bitmapTransformation)Set a custom in-place bitmap transformation that is applied immediately after decoding. BitmapTransformationgetBitmapTransformation()TsetColorSpace(ColorSpace colorSpace)Sets the target color space for decoding. ColorSpacegetColorSpace()Gets the target color space for decoding. TsetExcludeBitmapConfigFromComparison(boolean excludeBitmapConfigFromComparison)booleangetExcludeBitmapConfigFromComparison()ImageDecodeOptionsbuild()Builds the immutable ImageDecodeOptions instance. -
-
Method Detail
-
setFrom
ImageDecodeOptionsBuilder setFrom(ImageDecodeOptions options)
Sets the builder to be equivalent to the specified options.
- Parameters:
options- the options to copy from
-
setMinDecodeIntervalMs
T setMinDecodeIntervalMs(int intervalMs)
Sets the minimum decode interval.
Decoding of intermediate results won't happen more often that intervalMs. If anotherintermediate result comes too soon, it will be decoded only after intervalMs since the lastdecode. If there were more intermediate results in between, only the last one gets decoded.
- Parameters:
intervalMs- the minimum decode interval in milliseconds
-
getMinDecodeIntervalMs
int getMinDecodeIntervalMs()
Gets the minimum decode interval.
-
setMaxDimensionPx
T setMaxDimensionPx(int maxDimensionPx)
Sets the maximum image dimension (width or height).
- Parameters:
maxDimensionPx- the maximum image dimension in pixels
-
getMaxDimensionPx
int getMaxDimensionPx()
Gets the maximum image dimension (width or height).
-
setDecodePreviewFrame
T setDecodePreviewFrame(boolean decodePreviewFrame)
Sets whether to decode a preview frame for animated images.
- Parameters:
decodePreviewFrame- whether to decode a preview frame
-
getDecodePreviewFrame
boolean getDecodePreviewFrame()
Gets whether to decode a preview frame for animated images.
-
getUseLastFrameForPreview
boolean getUseLastFrameForPreview()
Gets whether to use the last frame for the preview image (defaults to the first frame).
-
setUseLastFrameForPreview
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
-
getDecodeAllFrames
boolean getDecodeAllFrames()
Gets whether to decode all the frames and store them in memory. This should only ever be usedfor animations that are known to be small (e.g. stickers). Caching dozens of large Bitmaps inmemory for general GIFs or WebP's will not fit in memory.
-
setDecodeAllFrames
T setDecodeAllFrames(boolean decodeAllFrames)
Sets whether to decode all the frames and store them in memory. This should only ever be usedfor animations that are known to be small (e.g. stickers). Caching dozens of large Bitmaps inmemory for general GIFs or WebP's will not fit in memory.
- Parameters:
decodeAllFrames- whether to decode all the frames and store them in memory
-
setForceStaticImage
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
-
setCustomImageDecoder
T setCustomImageDecoder(@Nullable() ImageDecoder customImageDecoder)
Set a custom image decoder override to be used for the given image. This will bypass alldefault decoders and only use the provided custom image decoder for the given image.
- Parameters:
customImageDecoder- the custom decoder to use
-
getCustomImageDecoder
@Nullable() ImageDecoder getCustomImageDecoder()
Get the custom image decoder, if one has been set.
-
getForceStaticImage
boolean getForceStaticImage()
Gets whether to force animated image formats to be decoded as static, non-animated images.
-
getBitmapConfig
Bitmap.Config getBitmapConfig()
Gets which config image will be decode with;
-
setBitmapConfig
T setBitmapConfig(Bitmap.Config bitmapConfig)
Sets which config static image will be decode with;
- Parameters:
bitmapConfig- which config static image will be decode with;
-
getAnimatedBitmapConfig
Bitmap.Config getAnimatedBitmapConfig()
Gets which config the animated image will be decode with;
-
setAnimatedBitmapConfig
T setAnimatedBitmapConfig(Bitmap.Config animatedBitmapConfig)
Sets which config the animated image will be decode with;
- Parameters:
animatedBitmapConfig- which config animated image will be decode with;
-
setBitmapTransformation
T setBitmapTransformation(@Nullable() BitmapTransformation bitmapTransformation)
Set a custom in-place bitmap transformation that is applied immediately after decoding.
- Parameters:
bitmapTransformation- the transformation to use
-
getBitmapTransformation
@Nullable() BitmapTransformation getBitmapTransformation()
-
setColorSpace
T setColorSpace(ColorSpace colorSpace)
Sets the target color space for decoding. When possible, the color space transformation will beperformed at load time. This requires SDK version >= 26, otherwise it's a no-op.
- Parameters:
colorSpace- target color space for decoding.
-
getColorSpace
@Nullable() ColorSpace getColorSpace()
Gets the target color space for decoding.
-
setExcludeBitmapConfigFromComparison
T setExcludeBitmapConfigFromComparison(boolean excludeBitmapConfigFromComparison)
-
getExcludeBitmapConfigFromComparison
boolean getExcludeBitmapConfigFromComparison()
-
build
ImageDecodeOptions build()
Builds the immutable ImageDecodeOptions instance.
-
-
-
-