kurbo

Function dash

source
pub fn dash<'a>(
    inner: impl Iterator<Item = PathEl> + 'a,
    dash_offset: f64,
    dashes: &'a [f64],
) -> impl Iterator<Item = PathEl> + 'a
Expand description

Create a new dashing iterator.

Handling of dashes is fairly orthogonal to stroke expansion. This iterator is an internal detail of the stroke expansion logic, but is also available separately, and is expected to be useful when doing stroke expansion on GPU.

It is implemented as an iterator-to-iterator transform. Because it consumes the input sequentially and produces consistent output with correct joins, it requires internal state and may allocate.

Accuracy is currently hard-coded to 1e-6. This is better than generally expected, and care is taken to get cusps correct, among other things.