Struct usvg_tree::PathData

source ·
pub struct PathData { /* private fields */ }
Expand description

An SVG path data container.

All segments are in absolute coordinates.

Implementations§

source§

impl PathData

source

pub fn new() -> Self

Creates a new path.

source

pub fn is_empty(&self) -> bool

Returns true if the path contains no segment.

source

pub fn len(&self) -> usize

Returns the number of segments in the path.

source

pub fn commands(&self) -> &[PathCommand]

Returns a slice of the path commands.

source

pub fn points(&self) -> &[f64]

Returns a slice of the path points.

source

pub fn clear(&mut self)

Clears the path.

source

pub fn shrink_to_fit(&mut self)

Shrinks the capacity of the path as much as possible.

source

pub fn from_rect(rect: Rect) -> Self

Creates a path from a rect.

source

pub fn push_move_to(&mut self, x: f64, y: f64)

Pushes a MoveTo segment to the path.

source

pub fn push_line_to(&mut self, x: f64, y: f64)

Pushes a LineTo segment to the path.

source

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.

source

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.

source

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.

source

pub fn push_close_path(&mut self)

Pushes a ClosePath segment to the path.

source

pub fn push_rect(&mut self, rect: Rect)

Pushes a rect to the path.

source

pub fn push_path(&mut self, path: &PathData)

Pushes a path to the path.

source

pub fn bbox(&self) -> Option<PathBbox>

Calculates path’s bounding box.

This operation is expensive.

source

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.

source

pub fn has_bbox(&self) -> bool

Checks that path has a bounding box.

This operation is expensive.

source

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.

source

pub fn transform(&mut self, ts: Transform)

Applies the transform to the path.

source

pub fn transform_from(&mut self, offset: usize, ts: Transform)

Applies the transform to the path from the specified offset.

source

pub fn segments(&self) -> PathSegmentsIter<'_>

Returns an iterator over path segments.

Trait Implementations§

source§

impl Clone for PathData

source§

fn clone(&self) -> PathData

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for PathData

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for PathData

source§

fn default() -> PathData

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.