pub struct PathData { /* private fields */ }
Expand description
An SVG path data container.
All segments are in absolute coordinates.
Implementations§
source§impl PathData
impl PathData
sourcepub fn commands(&self) -> &[PathCommand]
pub fn commands(&self) -> &[PathCommand]
Returns a slice of the path commands.
sourcepub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
Shrinks the capacity of the path as much as possible.
sourcepub fn push_move_to(&mut self, x: f64, y: f64)
pub fn push_move_to(&mut self, x: f64, y: f64)
Pushes a MoveTo segment to the path.
sourcepub fn push_line_to(&mut self, x: f64, y: f64)
pub fn push_line_to(&mut self, x: f64, y: f64)
Pushes a LineTo segment to the path.
sourcepub fn push_quad_to(&mut self, x1: f64, y1: f64, x: f64, y: f64)
pub fn push_quad_to(&mut self, x1: f64, y1: f64, x: f64, y: f64)
Pushes a QuadTo segment to the path.
Will be converted into cubic curve.
sourcepub fn push_curve_to(
&mut self,
x1: f64,
y1: f64,
x2: f64,
y2: f64,
x: f64,
y: f64
)
pub fn push_curve_to( &mut self, x1: f64, y1: f64, x2: f64, y2: f64, x: f64, y: f64 )
Pushes a CurveTo segment to the path.
sourcepub fn push_arc_to(
&mut self,
rx: f64,
ry: f64,
x_axis_rotation: f64,
large_arc: bool,
sweep: bool,
x: f64,
y: f64
)
pub fn push_arc_to( &mut self, rx: f64, ry: f64, x_axis_rotation: f64, large_arc: bool, sweep: bool, x: f64, y: f64 )
Pushes an ArcTo segment to the path.
Arc will be converted into cubic curves.
sourcepub fn push_close_path(&mut self)
pub fn push_close_path(&mut self)
Pushes a ClosePath segment to the path.
sourcepub fn bbox(&self) -> Option<PathBbox>
pub fn bbox(&self) -> Option<PathBbox>
Calculates path’s bounding box.
This operation is expensive.
sourcepub fn bbox_with_transform(
&self,
ts: Transform,
stroke: Option<&Stroke>
) -> Option<PathBbox>
pub fn bbox_with_transform( &self, ts: Transform, stroke: Option<&Stroke> ) -> Option<PathBbox>
Calculates path’s bounding box with a specified transform.
This operation is expensive.
sourcepub fn has_bbox(&self) -> bool
pub fn has_bbox(&self) -> bool
Checks that path has a bounding box.
This operation is expensive.
sourcepub fn length(&self) -> f64
pub fn length(&self) -> f64
Calculates path’s length.
Length from the first segment to the first MoveTo, ClosePath or slice end.
This operation is expensive.
sourcepub fn transform_from(&mut self, offset: usize, ts: Transform)
pub fn transform_from(&mut self, offset: usize, ts: Transform)
Applies the transform to the path from the specified offset.
sourcepub fn segments(&self) -> PathSegmentsIter<'_> ⓘ
pub fn segments(&self) -> PathSegmentsIter<'_> ⓘ
Returns an iterator over path segments.