Package 

Interface AnimatedDrawableBackend


  • 
    public interface AnimatedDrawableBackend
    
                        

    Interface that com.facebook.fresco.animation.drawable.BaseAnimatedDrawable uses that abstracts out the image format.

    • Method Detail

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

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

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