Skip to content

Commit

Permalink
Prepare 0.10.4 release; DashIterator doc
Browse files Browse the repository at this point in the history
Improve documentation of DashIterator and bump version in preparation for release.
  • Loading branch information
raphlinus committed Oct 19, 2023
1 parent 3a40570 commit 11c064f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "kurbo"
version = "0.10.3"
version = "0.10.4"
authors = ["Raph Levien <[email protected]>"]
license = "MIT OR Apache-2.0"
edition = "2021"
Expand Down
14 changes: 13 additions & 1 deletion src/stroke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ impl StrokeCtx {
}
}

/// Iterator for dashing.
/// An implementation of dashing as an iterator-to-iterator transformation.
pub struct DashIterator<'a, T> {
inner: T,
input_done: bool,
Expand Down Expand Up @@ -613,6 +613,18 @@ const DASH_ACCURACY: f64 = 1e-6;

impl<'a, T: Iterator<Item = PathEl>> DashIterator<'a, T> {
/// 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.
pub fn new(inner: T, dash_offset: f64, dashes: &'a [f64]) -> Self {
let mut dash_ix = 0;
let mut dash_remaining = dash_offset;
Expand Down

0 comments on commit 11c064f

Please sign in to comment.