pub struct Path {
commands: Vec<PathCommand>,
}Expand description
Owned path data — list of PathCommands plus consumer methods.
Fields§
§commands: Vec<PathCommand>Implementations§
Source§impl Path
impl Path
Sourcepub fn union_with(&self, other: &Path) -> Path
pub fn union_with(&self, other: &Path) -> Path
Fluent A ∪ B. Equivalent to
combine(self, other, BooleanOp::Union, BoolOptions::default()).
Sourcepub fn intersect_with(&self, other: &Path) -> Path
pub fn intersect_with(&self, other: &Path) -> Path
Fluent A ∩ B.
Source§impl Path
impl Path
Sourcepub fn from_commands(commands: Vec<PathCommand>) -> Self
pub fn from_commands(commands: Vec<PathCommand>) -> Self
Construct from a raw command vector. Prefer
PathBuilder for fluent construction.
Sourcepub fn commands(&self) -> &[PathCommand]
pub fn commands(&self) -> &[PathCommand]
Borrow the underlying commands.
Sourcepub fn flatten_subpaths(&self, tolerance: f32) -> Vec<Vec<Vec2>>
pub fn flatten_subpaths(&self, tolerance: f32) -> Vec<Vec<Vec2>>
Flatten Beziers to line segments per subpath, preserving
MoveTo boundaries. Each MoveTo starts a new
Vec<Vec2>; subsequent LineTo / QuadTo / CubicTo
commands append into the current subpath; Close appends a
final point back to the subpath’s start.
This is the multi-subpath variant of Path::flatten
(M-BOOL.7 / AUT-168). Boolean ops, masks, and any consumer
that needs to distinguish disjoint regions of a single
Path (e.g. holes, multi-shape clips) should use this
instead of the flat-concatenation Path::flatten.
tolerance semantics match Path::flatten. Empty paths
return an empty Vec; paths with only a MoveTo return a
single one-element subpath.
Sourcepub fn flatten(&self, tolerance: f32) -> Vec<Vec2>
pub fn flatten(&self, tolerance: f32) -> Vec<Vec2>
Flatten Beziers to line segments and return the resulting
polygon (a Vec<Vec2>). tolerance is the maximum
perpendicular distance from a control point to the chord
before the curve subdivides further. NDC units; 0.005 is a
reasonable default.
Open subpaths (no Close) end at the last point. Close
adds a line back to the most recent MoveTo.
For consumers that need to distinguish individual subpaths
(boolean ops, holes, multi-shape masks), use
Path::flatten_subpaths.
Sourcepub fn stroke_to_graphics(
&self,
width: f32,
color: Color,
tolerance: f32,
) -> Graphics
pub fn stroke_to_graphics( &self, width: f32, color: Color, tolerance: f32, ) -> Graphics
Rasterize this path as a stroked Graphics node. Each
flattened segment becomes a Graphics::draw_line call.
width is the stroke width in NDC units; tolerance controls
flatness of curves.
Sourcepub fn to_mask_polygon(&self, tolerance: f32) -> Vec<Vec2>
pub fn to_mask_polygon(&self, tolerance: f32) -> Vec<Vec2>
Convert to a crate::scene::VectorShape::Path for use as
a mask via the path-mask machinery. Caller is responsible for
keeping the vertex count under MAX_PATH_POINTS (32 vertices —
see path_clip.wgsl). Anything beyond the cap is silently
truncated by the path-mask shader.
Trait Implementations§
impl StructuralPartialEq for Path
Auto Trait Implementations§
impl Freeze for Path
impl RefUnwindSafe for Path
impl Send for Path
impl Sync for Path
impl Unpin for Path
impl UnsafeUnpin for Path
impl UnwindSafe for Path
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more