← back to roto on ba3a.dev

Package-level declarations

Types

Link copied to clipboard

Writes an animation as the bytes of one file. The same input gives the same bytes.

Link copied to clipboard
class AnimationExporter(project: Project, runner: ProcessRunner = SystemProcessRunner)

Exports a clip of a profile of project as one animated file in the profile's exports folder. The frames are the flipbook's: art where painted, else draft, else reference, flipped when mirrored and retimed as a publish would. A variant exports its base's clip with the ramp swaps applied.

Link copied to clipboard

An animated file format Roto writes.

Link copied to clipboard
class AnimationGroup(val member: PublishedFacing, val animations: List<PublishedAnimation>)

The animations that share one expansion of a format's path, and so one set of files.

Link copied to clipboard
data class AnimationOptions(val format: AnimationFormat = AnimationFormat.GIF, val scale: Int = DEFAULT_EXPORT_SCALE, val background: Int? = null)

The choices of one animated export. Whether it loops is not among them: that is the clip's own.

Link copied to clipboard

Writes an animated PNG: PngCodec encodes each frame, and this assembles their chunks. Frame 0 keeps its IDAT chunks, so a reader without APNG shows it. Every frame is the full canvas, replaces what was there and is cleared before the next. A delay is the duration over 1000, so it is exact.

Link copied to clipboard
data class BackgroundMapping(val requested: Int, val used: Int)

A background colour outside the project palette, and the palette colour used for it.

Link copied to clipboard
class CollectedAnimations(val groups: List<AnimationGroup>, val unpublished: List<PublishedFacing>, val manifests: List<Path>)

What a format's path holds after a publish.

Link copied to clipboard
class EngineFiles(project: Project, animations: PublishedAnimations)

The files a project's formats ask for beside its published frames.

Link copied to clipboard
class ExportContent(val frames: ExportFrames, val painted: Int)

What an export holds, known before anything is written.

Link copied to clipboard
class ExportFrame(val image: Raster, val durationMs: Int)

One frame of an export.

Link copied to clipboard
class ExportFrames(val name: String, val loop: Boolean, val frames: List<ExportFrame>)

An animation as an encoder takes it.

Link copied to clipboard

What every AnimationEncoder does to its frames before writing them: background, then scale.

Link copied to clipboard
class ExportResult(val file: Path, val painted: Int, val total: Int, val mappedBackground: BackgroundMapping?)

What an export wrote.

Link copied to clipboard
class ExportSource(val profileId: String, val profile: Profile, val folder: ProfileFolder, val clip: Clip, val mirrored: Boolean = false, val base: BaseProfile? = null)

Which clip an AnimationExporter exports, and how it is seen.

Link copied to clipboard
interface FormatWriter

Writes the files of one kind of formats entry.

Link copied to clipboard

Writes an animated GIF, byte for byte from its input. The global colour table is palette, after a transparent entry 0 when there is no background; opaque colours the frames hold beyond it follow in order of first appearance. Nothing is quantised or dithered. A pixel with alpha under 128 is transparent. Every frame is the full canvas and is cleared before the next. Delays are 10 ms units, rounded on cumulative time so that the total length stays exact.

Link copied to clipboard
class GodotAnimation(val name: String, val loop: Boolean, val frames: List<ManifestFrame>, val chosenSpeed: Int? = null)

One animation of a Godot SpriteFrames resource.

Link copied to clipboard

Writes the text of a Godot 4 SpriteFrames resource (.tres) that shows published frame PNGs. It carries no uid: Godot adds one on import. Lines end in \n, and numbers never pass through a locale.

Link copied to clipboard
object GodotSpeed

The speed of a Godot animation, in frames per second. A frame there lasts a number of units of 1 / speed seconds, and the natural unit is the greatest common divisor of the durations, which gives a speed of 1000 / divisor. The speed is kept a whole number: when that quotient is not one, it is the artist's choice, or else the quotient rounded half up and at least 1.

Link copied to clipboard

Writes a group of published animations as one Godot SpriteFrames resource that references their published frames.

Link copied to clipboard
class PackedSheet(val image: Raster, val frames: List<SheetFrame>, val tags: List<SheetTag>)

A packed sheet.

Link copied to clipboard
class PublishedAnimation(val name: String, val of: PublishedFacing, val loop: Boolean, val frames: List<ManifestFrame>, val chosenSpeed: Int? = null)

One animation of an engine file, as its manifest in the consuming project describes it.

Link copied to clipboard
class PublishedAnimations(project: Project, repository: ProfileRepository, profileId: String, source: BaseProfile)

Groups what is published in a consuming project by a format's path, and collects each group's animations from the published manifests, so a publish of a few clips never drops the others.

Link copied to clipboard
data class PublishedFacing(val profile: String, val action: String, val facing: String)

One facing of an action, as a profile publishes it.

Link copied to clipboard

The version of this build of Roto.

Link copied to clipboard
class SheetAnimation(val stem: String, val tag: String, val frames: ExportFrames)

One animation of a sheet.

Link copied to clipboard
data class SheetFrame(val filename: String, val x: Int, val y: Int, val width: Int, val height: Int, val durationMs: Int)

One frame as a sheet holds it.

Link copied to clipboard
@Serializable(with = SheetFramesSerializer::class)
sealed interface SheetFrames

The frames of a SheetJson, in the shape its SheetLayout gives them.

Link copied to clipboard
@Serializable
data class SheetFrameTag(val name: String, val from: Int, val to: Int, val direction: String)

One animation of a sheet.

Link copied to clipboard
@Serializable
data class SheetJson(val frames: SheetFrames, val meta: SheetMeta)

A sheet's description in the Aseprite sheet format. It holds no key that format lacks, as strict readers exist. Roto writes it and never reads it back.

Link copied to clipboard

Writes a sheet's SheetJson. Reading one is not supported and fails with a SheetJsonException.

Link copied to clipboard
class SheetJsonException(message: String, cause: Throwable? = null) : IOException

A sheet's JSON that cannot be handled.

Link copied to clipboard
@Serializable
data class SheetKeyedFrame(val frame: SheetRect, val rotated: Boolean, val trimmed: Boolean, val spriteSourceSize: SheetRect, val sourceSize: SheetSize, val duration: Int)

A frame of the keyed shape, whose key is its name.

Link copied to clipboard
@Serializable
enum SheetLayout : Enum<SheetLayout>

How a sheet's JSON holds its frames.

Link copied to clipboard
@Serializable
data class SheetListedFrame(val filename: String, val frame: SheetRect, val rotated: Boolean, val trimmed: Boolean, val spriteSourceSize: SheetRect, val sourceSize: SheetSize, val duration: Int)

A frame of the list shape.

Link copied to clipboard
@Serializable
data class SheetMeta(val app: String, val version: String, val image: String, val format: String, val size: SheetSize, val scale: String, val frameTags: List<SheetFrameTag>)

What a sheet is.

Link copied to clipboard

Lays the frames of animations out on one sheet, row by row, each in a cell of its own size: nothing is trimmed, rotated, padded or extruded, so the ground line and root stay where they were drawn.

Link copied to clipboard
@Serializable
data class SheetRect(val x: Int, val y: Int, val w: Int, val h: Int)

A rectangle in pixels.

Link copied to clipboard
@Serializable
data class SheetSize(val w: Int, val h: Int)

A size in pixels.

Link copied to clipboard
data class SheetTag(val name: String, val from: Int, val to: Int)

The run of a sheet's frames that is one animation.

Link copied to clipboard

Writes a group of published animations as one sprite sheet and its Aseprite-style JSON.

Link copied to clipboard

Writes a lossless animated WebP through ffmpeg, run by runner: the prepared frames go to a temporary folder as PNG, with a concat list giving their durations, and WebpTiming corrects the one duration ffmpeg gets wrong. ffmpeg merges identical neighbouring frames, adding their durations, and writes a still picture when all frames are identical.

Link copied to clipboard
object WebpTiming

Corrects the timing of an animated WebP as ffmpeg writes it: every frame duration is right except the last one's. Works on the RIFF bytes alone, so no picture data is decoded or rewritten.

Properties

Link copied to clipboard
const val DEFAULT_EXPORT_SCALE: Int = 4

The scale of an animated export until another is chosen.