svg_path/clip
Curve clipping helpers.
These functions clip path geometry, not filled areas. The clipping region
is interpreted as a filled Path, but the input geometry is interpreted as
curves to keep or discard. Returned subpaths contain only pieces of the
original input geometry; no bridge segments from the clipping boundary are
inserted.
Types
Options for curve clipping.
pub type Options {
Options(
intersection: intersections.IntersectionOptions,
containment: svg_path.ContainmentOptions,
tolerance: Float,
)
}
Constructors
-
Options( intersection: intersections.IntersectionOptions, containment: svg_path.ContainmentOptions, tolerance: Float, )
Values
pub fn path(
input: svg_path.Path,
to clip_region: svg_path.Path,
using fill_rule: svg_path.FillRule,
) -> Result(svg_path.Path, svg_path.Error)
Clip every subpath in input to the filled clip_region.
The result keeps only portions of the original input geometry whose sample point is inside or on the boundary of the clipping region. Open inputs may produce zero or more open subpaths. Closed inputs may also produce open subpaths when the clipping boundary cuts them; a closed input remains closed only when it survives whole.
pub fn path_with(
input: svg_path.Path,
to clip_region: svg_path.Path,
using fill_rule: svg_path.FillRule,
options options: Options,
) -> Result(svg_path.Path, svg_path.Error)
Clip every subpath in input using explicit options.
pub fn subpath(
input: svg_path.Subpath,
to clip_region: svg_path.Path,
using fill_rule: svg_path.FillRule,
) -> Result(List(svg_path.Subpath), svg_path.Error)
Clip one subpath to the filled clip_region.
Returned subpaths preserve traversal order. No closing or bridge segments are added at clipping-boundary crossings.
pub fn subpath_with(
input: svg_path.Subpath,
to clip_region: svg_path.Path,
using fill_rule: svg_path.FillRule,
options options: Options,
) -> Result(List(svg_path.Subpath), svg_path.Error)
Clip one subpath using explicit options.