Cauldron2D.Mask (Cauldron2D v0.2.2)

Copy Markdown View Source

Which pixels of a picture are solid, one bit each.

bits holds height rows, each padded to whole bytes, the leftmost pixel of a byte in its high bit.

mask = Cauldron2D.Mask.from_raster(raster)
Cauldron2D.Mask.set?(mask, {3, 7})

Summary

Functions

The mask of raster's pixels whose alpha is at least threshold (default 1).

A mask from rows of bits as described above.

Whether pixel {x, y} is solid; pixels outside the mask are not.

Types

t()

@type t() :: %Cauldron2D.Mask{
  bits: binary(),
  height: pos_integer(),
  width: pos_integer()
}

Functions

from_raster(raster, threshold \\ 1)

@spec from_raster(FrenchCurve.Raster.t(), 1..255) :: t()

The mask of raster's pixels whose alpha is at least threshold (default 1).

new(width, height, bits)

@spec new(pos_integer(), pos_integer(), binary()) :: t()

A mask from rows of bits as described above.

set?(mask, arg2)

@spec set?(t(), {integer(), integer()}) :: boolean()

Whether pixel {x, y} is solid; pixels outside the mask are not.