Back to Fresco

WebpAnimationBackend

docs/javadoc/reference/com/facebook/animated/webpdrawable/WebpAnimationBackend.html

3.6.018.7 KB
Original Source

Fresco

|

|

Packages | Classes

Classes

Packages | Classes

Summary: Inherited Constants | Methods | Inherited Methods | [Expand All]

public class

WebpAnimationBackend

extends Object
implements AnimationBackend

| java.lang.Object | | ↳ | com.facebook.animated.webpdrawable.WebpAnimationBackend |

Class Overview

Animation backend that is used to draw webp frames.

Summary

| [Expand] Inherited Constants | | --- | | From interface com.facebook.fresco.animation.backend.AnimationBackend

| int | INTRINSIC_DIMENSION_UNSET | Default value if the intrinsic dimensions are not set. |

| | From interface com.facebook.fresco.animation.backend.AnimationInformation

| int | LOOP_COUNT_INFINITE | Loop count to be returned by getLoopCount() when the animation should be repeated indefinitely. |

|

Public Methods
void
Clean up animation data.
static WebpAnimationBackend
boolean
Draw the frame for the given frame number on the canvas.
int
Get the number of frames for the animation
int
Get the frame duration for a given frame number in milliseconds.
int
Get the intrinsic height of the underlying animation or INTRINSIC_DIMENSION_UNSET if not available.
int
Get the intrinsic width of the underlying animation or INTRINSIC_DIMENSION_UNSET if not available.
int
Get the number of loops the animation has or LOOP_COUNT_INFINITE for infinite looping.
int
Get the size of the animation backend.
void
Set the alpha value to be used for drawing frames in drawFrame(Drawable, Canvas, int) if supported.
synchronized void
Called when the bounds of the parent drawable are updated.
void
The color filter to be used for drawing frames in drawFrame(Drawable, Canvas, int) if supported.

| [Expand] Inherited Methods | | --- | | From class java.lang.Object

| Object | clone() | | boolean | equals(Object arg0) | | void | finalize() | | final Class<?> | getClass() | | int | hashCode() | | final void | notify() | | final void | notifyAll() | | String | toString() | | final void | wait(long arg0, int arg1) | | final void | wait(long arg0) | | final void | wait() |

| | From interface com.facebook.fresco.animation.backend.AnimationBackend

| 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. |

| | From interface com.facebook.fresco.animation.backend.AnimationInformation

| abstract int | getFrameCount() Get the number of frames for the animation | | abstract int | getFrameDurationMs(int frameNumber) Get the frame duration for a given frame number in milliseconds. | | abstract int | getLoopCount() Get the number of loops the animation has or LOOP_COUNT_INFINITE for infinite looping. |

|

Public Methods

public 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 static WebpAnimationBackend create(String filePath)

Throws

| IOException | |

public 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 int getFrameCount()

Get the number of frames for the animation

Returns
  • the number of frames

public int getFrameDurationMs(int frameNumber)

Get the frame duration for a given frame number in milliseconds.

Parameters

| frameNumber | the frame to get the duration for |

Returns
  • the duration in ms

public 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
  • the height or INTRINSIC_DIMENSION_UNSET if unset

public 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
  • the width or INTRINSIC_DIMENSION_UNSET if unset

public int getLoopCount()

Get the number of loops the animation has or LOOP_COUNT_INFINITE for infinite looping.

Returns
  • the loop count or LOOP_COUNT_INFINITE

public int getSizeInBytes()

Get the size of the animation backend.

Returns
  • the size in bytes

public 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 synchronized 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 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 |

+Generated by Doclava. +