[][src]Struct svgdom::PathBuilder

pub struct PathBuilder { /* fields omitted */ }

A builder for Path.

Examples

Ellipse to path:

use svgtypes::PathBuilder;

let (cx, cy, rx, ry) = (10.0, 20.0, 5.0, 8.0);

let path = PathBuilder::with_capacity(6)
    .move_to(cx + rx, cy)
    .arc_to(rx, ry, 0.0, false, true, cx,      cy + ry)
    .arc_to(rx, ry, 0.0, false, true, cx - rx, cy)
    .arc_to(rx, ry, 0.0, false, true, cx,      cy - ry)
    .arc_to(rx, ry, 0.0, false, true, cx + rx, cy)
    .close_path()
    .finalize();

assert_eq!(path.to_string(), "M 15 20 A 5 8 0 0 1 10 28 A 5 8 0 0 1 5 20 \
                              A 5 8 0 0 1 10 12 A 5 8 0 0 1 15 20 Z");

Methods

impl PathBuilder[src]

pub fn new() -> PathBuilder[src]

Constructs a new builder.

pub fn with_capacity(capacity: usize) -> PathBuilder[src]

Constructs a new builder with a specified capacity.

pub fn move_to(self, x: f64, y: f64) -> PathBuilder[src]

Appends a new absolute MoveTo segment.

pub fn rel_move_to(self, x: f64, y: f64) -> PathBuilder[src]

Appends a new relative MoveTo segment.

pub fn close_path(self) -> PathBuilder[src]

Appends a new absolute ClosePath segment.

pub fn rel_close_path(self) -> PathBuilder[src]

Appends a new relative ClosePath segment.

pub fn line_to(self, x: f64, y: f64) -> PathBuilder[src]

Appends a new absolute LineTo segment.

pub fn rel_line_to(self, x: f64, y: f64) -> PathBuilder[src]

Appends a new relative LineTo segment.

pub fn hline_to(self, x: f64) -> PathBuilder[src]

Appends a new absolute HorizontalLineTo segment.

pub fn rel_hline_to(self, x: f64) -> PathBuilder[src]

Appends a new relative HorizontalLineTo segment.

pub fn vline_to(self, y: f64) -> PathBuilder[src]

Appends a new absolute VerticalLineTo segment.

pub fn rel_vline_to(self, y: f64) -> PathBuilder[src]

Appends a new relative VerticalLineTo segment.

pub fn curve_to(
    self,
    x1: f64,
    y1: f64,
    x2: f64,
    y2: f64,
    x: f64,
    y: f64
) -> PathBuilder
[src]

Appends a new absolute CurveTo segment.

pub fn rel_curve_to(
    self,
    x1: f64,
    y1: f64,
    x2: f64,
    y2: f64,
    x: f64,
    y: f64
) -> PathBuilder
[src]

Appends a new relative CurveTo segment.

pub fn smooth_curve_to(self, x2: f64, y2: f64, x: f64, y: f64) -> PathBuilder[src]

Appends a new absolute SmoothCurveTo segment.

pub fn rel_smooth_curve_to(
    self,
    x2: f64,
    y2: f64,
    x: f64,
    y: f64
) -> PathBuilder
[src]

Appends a new relative SmoothCurveTo segment.

pub fn quad_to(self, x1: f64, y1: f64, x: f64, y: f64) -> PathBuilder[src]

Appends a new absolute QuadTo segment.

pub fn rel_quad_to(self, x1: f64, y1: f64, x: f64, y: f64) -> PathBuilder[src]

Appends a new relative QuadTo segment.

pub fn smooth_quad_to(self, x: f64, y: f64) -> PathBuilder[src]

Appends a new absolute SmoothQuadTo segment.

pub fn rel_smooth_quad_to(self, x: f64, y: f64) -> PathBuilder[src]

Appends a new relative SmoothQuadTo segment.

pub fn arc_to(
    self,
    rx: f64,
    ry: f64,
    x_axis_rotation: f64,
    large_arc: bool,
    sweep: bool,
    x: f64,
    y: f64
) -> PathBuilder
[src]

Appends a new absolute ArcTo segment.

pub fn rel_arc_to(
    self,
    rx: f64,
    ry: f64,
    x_axis_rotation: f64,
    large_arc: bool,
    sweep: bool,
    x: f64,
    y: f64
) -> PathBuilder
[src]

Appends a new relative ArcTo segment.

pub fn finalize(self) -> Path[src]

Finalizes the build.

Auto Trait Implementations

impl Send for PathBuilder

impl Sync for PathBuilder

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]