mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-25 02:07:09 -06:00
Object > Live Paint > Gap Options was a stub, and paint leaked through any gap between the paths of a Live Paint group. The reference app's Gap Options stop paint at small gaps, close them with unpainted paths and preview them on the canvas. livePaint.gapOptions (Gap Options) sets a group's options: detect (Gap Detection), size (small 3 pt, medium 6 pt, large 12 pt, or a custom size over 0 up to 72 pt), color (the Gap Preview Color, #rrggbb or a layer color's name) and closeGaps, which adds an unpainted path across each gap to the group's paths. A gap runs from a loose end of a path to the nearest point of any path within the size, unless the paths already join the two close by. With detection on, the faces are made again as if a line closed each gap, and each face or edge keeps the look of the old one it lies in or on. The options are stored on the group, so they are saved, copied and undone with it, and Expand drops them. Merge keeps the bottom group's options when its Gap Detection is on, or else turns Gap Detection on with Small when another merged group has it on. When Gap Detection is off in every merged group, Merge keeps it off. livePaint.info lists the options and the gaps up to the size wide that no path closes. The menu item opens a Gap Options dialog. With Preview on, the options apply live and the gaps show on the canvas in the preview color, and OK keeps them as one undo step. vectorcraft-pathops gains find_gaps and live_paint_with_gaps. Docs: docs/mcp.md, docs/target-app-parity.md. i18n: the 19 complete catalogs have rows for the dialog's labels, and bg's Gap Options menu label now names gaps instead of line spacing.
38 lines
1.5 KiB
Rust
38 lines
1.5 KiB
Rust
//! VectorCraft path operations: booleans (Pathfinder), shape builder regions, offset, outline stroke,
|
|
//! simplify and the other Object → Path commands.
|
|
//!
|
|
//! Booleans are curve-preserving: `linesweeper`'s robust sweep-line works directly on cubic
|
|
//! Béziers, and the pieces it splits curves into are refitted afterwards so results carry few
|
|
//! anchors. See the crate README for the API overview.
|
|
#![forbid(unsafe_code)]
|
|
|
|
mod boolean;
|
|
mod edit;
|
|
mod fit;
|
|
mod offset;
|
|
mod pathfinder;
|
|
mod planar;
|
|
|
|
pub use boolean::{BoolOp, DEFAULT_PRECISION, area, boolean, boolean_n, normalize, try_boolean, try_normalize, unite_all};
|
|
pub use edit::{
|
|
AverageAxis, SimplifyOptions, add_anchor_points, average, join, remove_anchor, remove_redundant_points, simplify, simplify_with, smooth,
|
|
split_into_grid,
|
|
};
|
|
pub use offset::{Cap, Join, offset_path, outline_stroke, stroke_region};
|
|
pub use pathfinder::{FaceMerger, PathfinderOp, Region, Shape, merge_regions, pathfinder, region_at, regions};
|
|
pub use planar::{
|
|
BuilderArrangement, SHAPE_BUILDER_MAX_SEGMENTS, cut_out, encloses_area, find_gaps, has_open_path, interior_point, live_paint,
|
|
live_paint_with_gaps, shape_builder,
|
|
};
|
|
|
|
/// Errors from fallible operations.
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, thiserror::Error)]
|
|
pub enum PathOpsError {
|
|
#[error("input contains NaN or infinite coordinates")]
|
|
NonFinite,
|
|
#[error("input path could not be closed")]
|
|
OpenPath,
|
|
#[error("the shapes are too degenerate to combine")]
|
|
Degenerate,
|
|
}
|