← back to roto on ba3a.dev

Package-level declarations

Types

Link copied to clipboard
@Serializable
data class ClipShading(val zones: List<ZoneShading>)

How every zone of a clip is shaded, by zone: zones index i shades the zone labelled i + 1.

Link copied to clipboard
@Serializable
data class DraftColours(val zones: List<List<Int>>, val outline: Int? = null)

The colours a clip's draft is shaded and finished in, as palette labels — palette index plus one, so 0 stays background, as in zone maps, and can be the transparent entry of an indexed .ase. zones holds each zone's ramp, darkest first; outline the project's outline colour, or null to outline each zone in its ramp's darkest.

Link copied to clipboard
class DraftShader(cache: StageCache)

The draft shading stage: each key frame, sampled onto the canvas at FACTOR times its size and shaded by RampShader, as palette labels. The draft is drawn large and reduced afterwards, so the reduction can vote on what every final pixel shows.

Link copied to clipboard
class RampShader(shading: ClipShading, zoneColours: List<List<Int>>)

Shades a frame: each pixel of a zone takes the ramp step its OKLab lightness falls in under the clip's shading, and so the palette label zoneColours gives that step. Works at whatever size it is given, the frame and its zone map sampled alike.

Link copied to clipboard
@Serializable
data class ShadeSettings(val lowPercentile: Double = 5.0, val highPercentile: Double = 95.0)

How a clip's zones are shaded; stored per clip in profile.json. Each zone's lightness range runs from its lowPercentile to its highPercentile over every frame of the clip, and is split evenly into the steps of its ramp. Trimming the extremes keeps a few specular highlights or deep creases from stretching the range and flattening everything else into the middle steps.

Link copied to clipboard

The shading stage: a clip's ClipShading by ShadingFit, over every frame, cached under the frames, the zone maps, the number of steps in each zone's ramp and the ShadeSettings. Moving a key-frame marker does not refit it: the thresholds belong to the whole clip.

Link copied to clipboard
object ShadingFit

Fits a clip's ClipShading: for each zone, the ShadeSettings percentiles of the OKLab lightness of all its pixels across every frame. Percentiles are nearest-rank on the sorted lightnesses, so the fit is exact and the same on every machine.

Link copied to clipboard
@Serializable
data class ZoneShading(val low: Double, val high: Double, val steps: Int)

How one zone is shaded: lightness low to high split evenly into steps steps, step 0 the darkest. Fixed for the whole clip, so one pixel colour takes one step in every frame.