Skip to content

ResourceAnimationCanvas

final class ResourceAnimationCanvas
Package: dev.joid.lib.resource.animation · Module: core · Source: ResourceAnimationCanvas.java

Builds the full images of an animation from frames that update only a part of the picture, as GIF, APNG and WebP store them.

Create one per file at the size of the animation, then compose each frame in order.

ReturnsSignatureSummary
ResourceAnimationCanvas(int width, int height)Creates a transparent canvas of width × height pixels.

ReturnsSignatureSummary
int[]compose(int[] frame, int x, int y, int frameWidth, int frameHeight, Blend blend, Disposal disposal)Draws frame, of frameWidth × frameHeight pixels, at x, y with blend, returns the full image that results, then prepares the canvas for the next frame as disposal says.
intgetWidth()Returns the width of the canvas.
intgetHeight()Returns the height of the canvas.
int[]getPixels()Returns the pixels of the canvas, as the next frame reads them.

ResourceAnimationCanvas(int width, int height)

Creates a transparent canvas of width × height pixels.

int[] compose(int[] frame, int x, int y, int frameWidth, int frameHeight, Blend blend, Disposal disposal)

Draws frame, of frameWidth × frameHeight pixels, at x, y with blend, returns the full image that results, then prepares the canvas for the next frame as disposal says. The part of the frame outside the canvas is ignored.

int getWidth()

Returns the width of the canvas.

int getHeight()

Returns the height of the canvas.

int[] getPixels()

Returns the pixels of the canvas, as the next frame reads them.


fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses

Report a problem with this page