Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ keyboard-types = "0.8"
url = "2.5"
tokio = { version = "1.29", features = ["fs", "macros", "io-std", "rt", "rt-multi-thread"] }
# Linebender ecosystem (BEGIN)
kurbo = { version = "0.13", features = ["serde"] }
kurbo = { git = "https://github.com/linebender/kurbo.git", features = ["serde"] }
vello = "0.8"
vello_encoding = "0.8"
resvg = "0.47"
Expand Down Expand Up @@ -245,3 +245,8 @@ debug = true
# Force cargo to use only one version of the dpi crate (vendoring breaks without this)
dpi = { git = "https://github.com/rust-windowing/winit.git" }
rfd = { git = "https://github.com/timon-schelling/rfd.git", branch = "graphite" } # TODO: Remove this once https://github.com/PolyMeilex/rfd/pull/317 is merged and released
download-cef = { git = "https://github.com/timon-schelling/cef-rs.git", branch = "graphite" }
# Force the Linebender ecosystem (vello, resvg, usvg, parley, etc.) to use the same git version of kurbo/polycool as our workspace
# TODO: Remove these when the Linebender ecosystem has its next update with Kurbo >0.13.0
kurbo = { git = "https://github.com/linebender/kurbo.git" }
polycool = { git = "https://github.com/linebender/kurbo.git" }
9 changes: 7 additions & 2 deletions node-graph/nodes/vector/src/vector_nodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1197,15 +1197,20 @@ async fn solidify_stroke<T: IntoGraphicTable + 'n + Send + Clone>(_: impl Ctx, #
.with_dashes(dash_offset, dash_pattern)
.with_miter_limit(miter_limit);

let stroke_options = kurbo::StrokeOpts::default();
// Pick `stable_dash_order` per subpath: closed subpaths use the default merge so the seam-spanning dash matches Vello/SVG renderers, while open subpaths use stable order so dashes are emitted in path-length sequence
let stroke_options_default = kurbo::StrokeOpts::default();
let stroke_options_stable = kurbo::StrokeOpts::default().stable_dash_order(true);

// 0.25 is balanced between performace and accuracy of the curve.
const STROKE_TOLERANCE: f64 = 0.25;

for mut path in bezpaths {
path.apply_affine(Affine::new(stroke.transform.to_cols_array()));

let mut solidified = kurbo::stroke(path, &stroke_style, &stroke_options, STROKE_TOLERANCE);
let is_closed = matches!(path.elements().last(), Some(kurbo::PathEl::ClosePath));
let stroke_options = if is_closed { &stroke_options_default } else { &stroke_options_stable };

let mut solidified = kurbo::stroke(path, &stroke_style, stroke_options, STROKE_TOLERANCE);
if stroke.transform.matrix2.determinant() != 0. {
solidified.apply_affine(Affine::new(stroke.transform.inverse().to_cols_array()));
}
Expand Down
Loading