← back to roto on ba3a.dev

Package-level declarations

Types

Link copied to clipboard
object HexColor

Opaque colours written as #rrggbb, the way palette files and ramps.json write them.

Link copied to clipboard

An opaque colour stored in JSON as #rrggbb.

Link copied to clipboard
data class Palette(val colors: List<Int>)

A project's palette: the opaque colours every draft is drawn in, in the order the palette file lists them. At most MAX_COLORS: an indexed .ase holds 256 entries, and the handoff keeps one of them for transparency.

Link copied to clipboard

Appends a colour to a project's palette file, after the colours already there. Only a .hex palette with room for one more colour, and without that colour, can take it; unavailableReason says which of these fails, in words fit to show the artist. A palette file that cannot be read or written is an java.io.IOException.

Link copied to clipboard

Reads a Palette from the two plain-text formats pixel artists share palettes in, told apart by the file's extension, and writes one as .hex:

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

A palette file that is malformed, of an unknown kind, or not a valid Palette.

Link copied to clipboard

Maps a raster onto a Palette: each pixel at least half opaque takes the palette colour nearest to it in OKLab, the first on a tie, written as a palette label (index plus one); every other pixel is 0, background. How a reference photo becomes something an indexed sprite can hold.

Link copied to clipboard
class ProjectPalette(val palette: Palette, val ramps: RampSet)

A project's palette and its ramps, checked against each other: every ramp colour, and the outline colour if there is one, is a palette colour. So whatever a draft is shaded or outlined in can be written into the indexed handoff.

Link copied to clipboard
@Serializable
data class Ramp(val name: String, val colors: List<@Serializable(with = HexColorSerializer::class) Int>)

A named run of palette colors from darkest to lightest, as the artist shades one material: skin, cloth, metal. Shading picks a step by lightness, so the colours must grow strictly lighter in OKLab; the first is the darkest, which also outlines the ramp's regions.

Link copied to clipboard
object RampEditor

Builds a Ramp from the colours the artist picked: sorts them dark to light by OKLab lightness, so the order they were clicked in does not matter, and says in plain words why a pick cannot be a ramp. Every failure is an IllegalArgumentException whose message is fit to show the artist.

Link copied to clipboard
@Serializable
data class RampSet(val outline: @Serializable(with = HexColorSerializer::class) Int? = null, val ramps: List<Ramp>)

A project's ramps.json: its named ramps and, optionally, the outline colour drafts are outlined in. Without one, each region is outlined in its own ramp's darkest colour.

Link copied to clipboard

Reads and writes a project's ramps.json as a RampSet.

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

A ramps.json that is malformed, fails RampSet's validation, or uses colours its palette lacks.

Link copied to clipboard

Suggests ramps for a Palette: a deterministic starting point the artist then edits.