public class Spectrum
extends java.lang.Object
Spectrum class provides access to the decode(com.facebook.spectrum.EncodedImageSource, com.facebook.spectrum.BitmapTarget, com.facebook.spectrum.options.DecodeOptions, java.lang.Object), encode(android.graphics.Bitmap, com.facebook.spectrum.EncodedImageSink, com.facebook.spectrum.options.EncodeOptions, java.lang.Object), transcode(com.facebook.spectrum.EncodedImageSource, com.facebook.spectrum.EncodedImageSink, com.facebook.spectrum.options.TranscodeOptions, java.lang.Object), and transform(android.graphics.Bitmap, com.facebook.spectrum.BitmapTarget, com.facebook.spectrum.options.TransformOptions, java.lang.Object) operations.
Once created, a Spectrum object is thread-safe in respect to the executed operations.
If ised repeatedly, consider retaining an instance around in your application.
| Modifier and Type | Method and Description |
|---|---|
SpectrumResult |
decode(EncodedImageSource source,
BitmapTarget bitmapTarget,
DecodeOptions decodeOptions,
java.lang.Object callerContext)
A decode operation reads an encoded image and creates a bitmap.
|
SpectrumResult |
encode(android.graphics.Bitmap bitmap,
EncodedImageSink sink,
EncodeOptions encodeOptions,
java.lang.Object callerContext)
An encode operation reads a bitmap and creates an encoded image.
|
boolean |
isAvailable() |
boolean |
isImageFormatSupported(ImageFormat imageFormat)
This method indicates whether the given image format is supported by Spectrum using the default
plugin.
|
static Spectrum |
make(SpectrumLogger spectrumLogger,
Configuration configuration,
SpectrumPlugin... plugins)
Creates a new
Spectrum with the given SpectrumLogger, global Configuration, and the given SpectrumPlugins. |
static Spectrum |
make(SpectrumLogger spectrumLogger,
SpectrumPlugin[] plugins)
|
SpectrumResult |
transcode(EncodedImageSource source,
EncodedImageSink sink,
TranscodeOptions transcodeOptions,
java.lang.Object callerContext)
A transcode operation reads an encoded image and creates an encoded image.
|
SpectrumResult |
transform(android.graphics.Bitmap bitmap,
BitmapTarget bitmapTarget,
TransformOptions transformOptions,
java.lang.Object callerContext)
A transform operation reads a bitmap and creates a bitmap.
|
public static Spectrum make(SpectrumLogger spectrumLogger, SpectrumPlugin[] plugins)
Spectrum with the given SpectrumLogger and the given SpectrumPlugins. A default Configuration is used.public static Spectrum make(SpectrumLogger spectrumLogger, Configuration configuration, SpectrumPlugin... plugins)
Spectrum with the given SpectrumLogger, global Configuration, and the given SpectrumPlugins.public boolean isAvailable()
public SpectrumResult decode(EncodedImageSource source, BitmapTarget bitmapTarget, DecodeOptions decodeOptions, java.lang.Object callerContext) throws SpectrumException
source - The EncodedImageSource to read from.bitmapTarget - The BitmapTarget to create and retain the created bitmap.decodeOptions - The DecodeOptions for this operation.callerContext - The caller context that identifies this particular call site.SpectrumResult containing information about the execution.SpectrumException - for invalid input, missing support and runtime errors.public SpectrumResult encode(android.graphics.Bitmap bitmap, EncodedImageSink sink, EncodeOptions encodeOptions, java.lang.Object callerContext) throws SpectrumException
bitmap - The Bitmap to read from.sink - The EncodedImageSink to write the encoded image to.encodeOptions - The EncodeOptions for this operation.callerContext - The caller context that identifies this particular call site.SpectrumResult containing information about the execution.SpectrumException - for invalid input, missing support and runtime errors.public SpectrumResult transcode(EncodedImageSource source, EncodedImageSink sink, TranscodeOptions transcodeOptions, java.lang.Object callerContext) throws SpectrumException
source - The EncodedImageSource to read from.sink - The EncodedImageSink to write the encoded image to.transcodeOptions - The TranscodeOptions for this operation.callerContext - The caller context that identifies this particular call site.SpectrumResult containing information about the execution.SpectrumException - for invalid input, missing support and runtime errors.public SpectrumResult transform(android.graphics.Bitmap bitmap, BitmapTarget bitmapTarget, TransformOptions transformOptions, java.lang.Object callerContext) throws SpectrumException
bitmap - The Bitmap to read frombitmapTarget - The BitmapTarget to create and retain the created bitmap.transformOptions - The TransformOptions for this operation.callerContext - The caller context that identifies this particular call site.SpectrumResult containing information about the execution.SpectrumException - for invalid input, missing support and runtime errors.public boolean isImageFormatSupported(ImageFormat imageFormat)