Skip to main content

Module raster

Module raster 

Source
Expand description

Coverage of a path: per pixel, the average winding number over the pixel’s area, mapped by the fill rule, in 16 by 16 pixel tiles.

Lines are accumulated only in the columns an edge touches, one strip of tile rows at a time (rasterize); a tile no edge reaches takes the winding of the run it lies in, without per-pixel work, and is Full or Empty. The prefix sums add the same non-zero contributions in the same order as accumulating every pixel would (dense::rasterize_dense, kept as the reference), so both give the same bytes.

Everything is scalar code in a fixed order: f64 geometry, f32 accumulation, no fused multiply-add. Coverage is the same bytes on every target.

Modules§

dense
The reference rasterizer: every pixel of the clip accumulated and summed. super::rasterize must give its bytes; tests and the fuzz target hold it to that.

Structs§

CoverageCache
Coverage by key, least recently used first out, within a byte budget.
RasterScratch
Buffers reused from one rasterization to the next.
TileCoverage
A path’s coverage over a rectangle of whole tiles.

Enums§

TileState
What one tile of coverage holds.

Constants§

TILE
Tile edge, in pixels.
TILE_BYTES
Bytes of one tile’s coverage.

Functions§

coverage_key
The key of path’s coverage under rule in clip: its bits, so only the same path in the same place shares it.
flattened
The flattened lines rasterize accumulates for path in clip, relative to the tile-aligned clip’s corner.
rasterize
The coverage of path under rule within clip (device pixels, grown to whole tiles): per pixel, the average winding number over its area, mapped by the rule. Nonzero is min(|w|, 1); even-odd a triangle wave of period 2 in |w|. Only pixels where three or more windings cross within the pixel are approximate.
tile_aligned
clip grown outward to whole tiles.
winding_at
The winding number of path around point, from its flattened lines: what a fill rule decides inside from, for hit tests.