Skip to main content

Module mask

Module mask 

Source
Expand description

AlphaMask operations — boolean ops, SDF rasterization, feathering.

AlphaMask is a TileStore<AlphaF32> (single-channel f32 per pixel). It’s used for selections, layer masks, and future mask-like concepts. The storage, COW, and transaction/memento infrastructure are inherited from the generic TileStore<F> in tile.rs.

Shape rasterization uses the shared SDF functions from sdf.rs. Selection tools provide an SDF closure to rasterize(), which evaluates it at each pixel center and writes coverage values into tiles.

Structs§

RasterizedMask
Result of rasterizing an SDF shape to a flat R8 buffer. Contains only the tight bounding region, not the full canvas.

Functions§

contour_polylines_r8
Same as contour_segments_r8 but returns chained polylines (one per connected contour) instead of a flat list of independent segments. Each inner Vec is a sequence of points forming a polyline: points [p0, p1, ..., pN] describe N connected segments. Closed contours have p0 == pN (within float tolerance).
contour_segments_r8
Extract contour segments from a flat R8 buffer using marching squares.
pixel_bounds_r8
Compute tight pixel bounding box from a flat R8 buffer. Returns [x, y, w, h] or None if all pixels are zero.
rasterize_polygon_r8
Rasterize a polygon into a tight-bounds R8 buffer using scanline fill.
rasterize_sdf_r8
Rasterize an SDF shape into a tight-bounds R8 buffer.