public interface

AnimationBackend

implements AnimationInformation
com.facebook.fresco.animation.backend.AnimationBackend
Known Indirect Subclasses

Class Overview

Animation backend interface that is used to draw frames.

Summary

Constants
int INTRINSIC_DIMENSION_UNSET Default value if the intrinsic dimensions are not set.
[Expand]
Inherited Constants
From interface com.facebook.fresco.animation.backend.AnimationInformation
Public Methods
abstract void clear()
Clean up animation data.
abstract boolean drawFrame(Drawable parent, Canvas canvas, int frameNumber)
Draw the frame for the given frame number on the canvas.
abstract int getIntrinsicHeight()
Get the intrinsic height of the underlying animation or INTRINSIC_DIMENSION_UNSET if not available.
abstract int getIntrinsicWidth()
Get the intrinsic width of the underlying animation or INTRINSIC_DIMENSION_UNSET if not available.
abstract int getSizeInBytes()
Get the size of the animation backend.
abstract void setAlpha(int alpha)
Set the alpha value to be used for drawing frames in drawFrame(Drawable, Canvas, int) if supported.
abstract void setBounds(Rect bounds)
Called when the bounds of the parent drawable are updated.
abstract void setColorFilter(ColorFilter colorFilter)
The color filter to be used for drawing frames in drawFrame(Drawable, Canvas, int) if supported.
[Expand]
Inherited Methods
From interface com.facebook.fresco.animation.backend.AnimationInformation

Constants

public static final int INTRINSIC_DIMENSION_UNSET

Default value if the intrinsic dimensions are not set.

Constant Value: -1 (0xffffffff)

Public Methods

public abstract void clear ()

Clean up animation data. This will be called when the backing drawable is cleared as well. For example, drop all cached frames.

public abstract boolean drawFrame (Drawable parent, Canvas canvas, int frameNumber)

Draw the frame for the given frame number on the canvas.

Parameters
parent the parent that draws the frame
canvas the canvas to draw an
frameNumber the frame number of the frame to draw
Returns
  • true if successful, false if the frame could not be rendered

public abstract int getIntrinsicHeight ()

Get the intrinsic height of the underlying animation or INTRINSIC_DIMENSION_UNSET if not available.

This value is used by the underlying drawable for aspect ratio computations, similar to getIntrinsicHeight().

Returns

public abstract int getIntrinsicWidth ()

Get the intrinsic width of the underlying animation or INTRINSIC_DIMENSION_UNSET if not available.

This value is used by the underlying drawable for aspect ratio computations, similar to getIntrinsicWidth().

Returns

public abstract int getSizeInBytes ()

Get the size of the animation backend.

Returns
  • the size in bytes

public abstract void setAlpha (int alpha)

Set the alpha value to be used for drawing frames in drawFrame(Drawable, Canvas, int) if supported.

Parameters
alpha the alpha value between 0 and 255

public abstract void setBounds (Rect bounds)

Called when the bounds of the parent drawable are updated. This can be used to perform some ahead-of-time computations if needed.

The supplied bounds do not have to be stored. It is possible to just use getBounds() of the parent drawable of drawFrame(Drawable, Canvas, int) instead.

Parameters
bounds the bounds to be used for drawing frames

public abstract void setColorFilter (ColorFilter colorFilter)

The color filter to be used for drawing frames in drawFrame(Drawable, Canvas, int) if supported.

Parameters
colorFilter the color filter to use