-
public interface AnimatedDrawableBackendInterface that com.facebook.fresco.animation.drawable.BaseAnimatedDrawable uses that abstracts out the image format.
-
-
Method Summary
Modifier and Type Method Description abstract AnimatedImageResultgetAnimatedImageResult()Gets the original result of the decode. abstract intgetDurationMs()Gets the duration of the animation. abstract intgetFrameCount()Gets the number of frames in the animation. abstract intgetLoopCount()Gets the number of loops to run the animation for. abstract intgetWidth()Gets the width of the image. abstract intgetHeight()Gets the height of the image. abstract intgetRenderedWidth()Gets the rendered width of the image. abstract intgetRenderedHeight()Gets the rendered height of the image. abstract AnimatedDrawableFrameInfogetFrameInfo(int frameNumber)Gets info about the specified frame. abstract voidrenderFrame(int frameNumber, Canvas canvas)Renders the specified frame onto the canvas. abstract voidrenderDeltas(int frameNumber, Canvas canvas)Renders the specified frame onto the canvas. abstract intgetFrameForTimestampMs(int timestampMs)Gets the frame index for specified timestamp. abstract intgetTimestampMsForFrame(int frameNumber)Gets the timestamp relative to the first frame that this frame number starts at. abstract intgetDurationMsForFrame(int frameNumber)Gets the duration of the specified frame. abstract intgetFrameForPreview()Gets the frame number to use for the preview frame. abstract AnimatedDrawableBackendforNewBounds(@Nullable() Rect bounds)Creates a new AnimatedDrawableBackend with the same parameters but with a new bounds. abstract intgetMemoryUsage()Gets the number of bytes currently used by the backend for caching (for debugging) abstract CloseableReference<Bitmap>getPreDecodedFrame(int frameNumber)Gets a pre-decoded frame. abstract booleanhasPreDecodedFrame(int frameNumber)Gets whether it has the decoded frame. abstract voiddropCaches()Instructs the backend to drop its caches. -
-
Method Detail
-
getAnimatedImageResult
abstract AnimatedImageResult getAnimatedImageResult()
Gets the original result of the decode.
-
getDurationMs
abstract int getDurationMs()
Gets the duration of the animation.
-
getFrameCount
abstract int getFrameCount()
Gets the number of frames in the animation.
-
getLoopCount
abstract int getLoopCount()
Gets the number of loops to run the animation for.
-
getWidth
abstract int getWidth()
Gets the width of the image.
-
getHeight
abstract int getHeight()
Gets the height of the image.
-
getRenderedWidth
abstract int getRenderedWidth()
Gets the rendered width of the image. This may be smaller than the underlying image width ifthe image is being rendered to a small bounds or to reduce memory requirements.
-
getRenderedHeight
abstract int getRenderedHeight()
Gets the rendered height of the image. This may be smaller than the underlying image height ifthe image is being rendered to a small bounds or to reduce memory requirements.
-
getFrameInfo
abstract AnimatedDrawableFrameInfo getFrameInfo(int frameNumber)
Gets info about the specified frame.
- Parameters:
frameNumber- the frame number (0-based)
-
renderFrame
abstract void renderFrame(int frameNumber, Canvas canvas)
Renders the specified frame onto the canvas.
- Parameters:
frameNumber- the frame number (0-based)canvas- the canvas to render onto
-
renderDeltas
abstract void renderDeltas(int frameNumber, Canvas canvas)
Renders the specified frame onto the canvas. The idea is the same than renderFrame(...) withthis differences: 1) Creates a new bitmap on each call. This allows to not block threads. 2)Blend is applied here
- Parameters:
frameNumber- the frame number (0-based)canvas- the canvas to render onto
-
getFrameForTimestampMs
abstract int getFrameForTimestampMs(int timestampMs)
Gets the frame index for specified timestamp.
- Parameters:
timestampMs- the timestamp
-
getTimestampMsForFrame
abstract int getTimestampMsForFrame(int frameNumber)
Gets the timestamp relative to the first frame that this frame number starts at.
- Parameters:
frameNumber- the frame number
-
getDurationMsForFrame
abstract int getDurationMsForFrame(int frameNumber)
Gets the duration of the specified frame.
- Parameters:
frameNumber- the frame number
-
getFrameForPreview
abstract int getFrameForPreview()
Gets the frame number to use for the preview frame.
-
forNewBounds
abstract AnimatedDrawableBackend forNewBounds(@Nullable() Rect bounds)
Creates a new AnimatedDrawableBackend with the same parameters but with a new bounds.
- Parameters:
bounds- the bounds
-
getMemoryUsage
abstract int getMemoryUsage()
Gets the number of bytes currently used by the backend for caching (for debugging)
-
getPreDecodedFrame
@Nullable() abstract CloseableReference<Bitmap> getPreDecodedFrame(int frameNumber)
Gets a pre-decoded frame. This will only return non-null if the
{@code ImageDecodeOptions}wereconfigured to decode all frames at decode time.- Parameters:
frameNumber- the index of the frame to get
-
hasPreDecodedFrame
abstract boolean hasPreDecodedFrame(int frameNumber)
Gets whether it has the decoded frame. This will only return true if the
{@code * ImageDecodeOptions}were configured to decode all frames at decode time.- Parameters:
frameNumber- the index of the frame to get
-
dropCaches
abstract void dropCaches()
Instructs the backend to drop its caches.
-
-
-
-