Linocut.Sheet (Linocut v0.2.2)

Copy Markdown View Source

A sprite sheet cut into frames.

Linocut.Sheet.cut(raster, band: 0, gap: 6)

The sheet's background must already be clear. Rows of frames are found as bands of pixels separated by blank rows, and frames within a band as runs of columns separated by blank columns. Every frame comes back the same size, each centred across and standing on the band's own floor, so a walk cycle keeps its feet on one line.

Summary

Functions

The frames of raster, left to right.

Every band's frames, top band first, all padded to one size.

The rows of raster holding any pixel, as {row, holds?}.

Runs of true in flags, as {first, last}, joining runs closer than gap apart.

Types

box()

@type box() :: {integer(), integer(), pos_integer(), pos_integer()}

Functions

cut(raster, opts \\ [])

The frames of raster, left to right.

Options

  • :band — which row of frames to cut, counting from the top. Default 0
  • :gap — how many blank columns or rows separate one frame or row from the next. Default 6
  • :alpha — the alpha at or above which a pixel counts. Default 16

cut_all(raster, opts \\ [])

Every band's frames, top band first, all padded to one size.

Takes cut/2's :gap and :alpha.

rows(raster, alpha)

@spec rows(FrenchCurve.Raster.t(), non_neg_integer()) :: [boolean()]

The rows of raster holding any pixel, as {row, holds?}.

runs(flags, gap)

@spec runs([boolean()], non_neg_integer()) :: [{non_neg_integer(), non_neg_integer()}]

Runs of true in flags, as {first, last}, joining runs closer than gap apart.