[][src]Struct wasm_svg_graphics::prelude::PathData

pub struct PathData { /* fields omitted */ }

Methods

impl PathDefinitionString[src]

pub fn new() -> PathDefinitionString[src]

Creates a new empty instance of a PathDefinitionString

Note

Eventhough, one can input f64's the actual output string will always output number with 2 decimals points.

pub fn is_str(&self, eq: &str) -> bool[src]

Compares input string with PathDefinitionString and returns true if both are equal

Note / Arguments

For further information: Look here

Examples

use svg_definitions::prelude::*;

let path_definition_string = PathData::new()
    .move_to((3.0, 3.0))
    .line_to((6.0, 6.0))
    .close_path();

// Both of these statements are equivalent
let eq_1 = path_definition_string.to_string() == String::from("M 3.00 3.00 L 6.00 6.00 Z");
let eq_2 = path_definition_string.is_str("M 3.00 3.00 L 6.00 6.00 Z");

pub fn move_to(self, (f32, f32)) -> PathDefinitionString[src]

Appends a move to a certain point to the [PathDefinitionString]

Note / Arguments

For further information: Look here

Examples

use svg_definitions::prelude::*;

let path_definition_string = PathData::new()
    .move_to((3.0, 3.0));

// Will output "M 3.00 3.00"
println!("{}", path_definition_string);

pub fn line_to(self, (f32, f32)) -> PathDefinitionString[src]

Appends a line to a certain point to the [PathDefinitionString]

Note / Arguments

For further information: Look here

Examples

use svg_definitions::prelude::*;

let path_definition_string = PathData::new()
    .move_to((3.0, 3.0))
    .line_to((10.0, 10.0));

// Will output "M 3.00 3.00 L 10.00 10.00"
println!("{}", path_definition_string);

pub fn horizontal_line_to(self, x: f64) -> PathDefinitionString[src]

Appends a horizontal line to a certain x-value to the [PathDefinitionString]

Note / Arguments

For further information: Look here

Examples

use svg_definitions::prelude::*;

let path_definition_string = PathData::new()
    .move_to((3.0, 3.0))
    .horizontal_line_to(10.0);

// Will output "M 3.00 3.00 H 10.00"
println!("{}", path_definition_string);

pub fn vertical_line_to(self, y: f64) -> PathDefinitionString[src]

Appends a vertical line to a certain y-value to the [PathDefinitionString]

Note / Arguments

For further information: Look here

Examples

use svg_definitions::prelude::*;

let path_definition_string = PathData::new()
    .move_to((3.0, 3.0))
    .vertical_line_to(10.0);

// Will output "M 3.00 3.00 V 10.00"
println!("{}", path_definition_string);

pub fn r_line_to(self, (f32, f32)) -> PathDefinitionString[src]

Appends a line to a certain point relative to where the last action ended to the [PathDefinitionString]

Note / Arguments

For further information: Look here

Examples

use svg_definitions::prelude::*;

let path_definition_string = PathData::new()
    .move_to((3.0, 3.0))
    .r_line_to((7.0, 7.0));

// Will output "M 3.00 3.00 l 7.00 7.00"
println!("{}", path_definition_string);

pub fn r_horizontal_line_to(self, dx: f64) -> PathDefinitionString[src]

Appends a horizontal line to a certain x-value relative to where the last action ended to the [PathDefinitionString]

Note / Arguments

For further information: Look here

Examples

use svg_definitions::prelude::*;

let path_definition_string = PathData::new()
    .move_to((3.0, 3.0))
    .r_horizontal_line_to(7.0);

// Will output "M 3.00 3.00 h 10.00"
println!("{}", path_definition_string);

pub fn r_vertical_line_to(self, dy: f64) -> PathDefinitionString[src]

Appends a vertical line to a certain y-value relative to where the last action ended to the [PathDefinitionString]

Note / Arguments

For further information: Look here

Examples

use svg_definitions::prelude::*;

let path_definition_string = PathData::new()
    .move_to((3.0, 3.0))
    .r_vertical_line_to(7.0);

// Will output "M 3.00 3.00 v 10.00"
println!("{}", path_definition_string);

pub fn curve_to(
    self,
    (f32, f32),
    (f32, f32),
    (f32, f32)
) -> PathDefinitionString
[src]

Appends a curve to a certain point to the [PathDefinitionString], using control point 1 & 2

Note / Arguments

For further information: Look here

Examples

use svg_definitions::prelude::*;

let path_definition_string = PathData::new()
    .move_to((3.0, 3.0))
    .curve_to((10.0, 10.0), (15.0, 20.0), (20.0, 25.0));

// Will output "M 3.00 3.00 C 15.00 20.00, 20.00 25.00, 10.00 10.00"
println!("{}", path_definition_string);

pub fn r_curve_to(
    self,
    (f32, f32),
    (f32, f32),
    (f32, f32)
) -> PathDefinitionString
[src]

Appends a curve to a certain point relative to where the last action ended to the [PathDefinitionString], using control point 1 & 2

Note / Arguments

For further information: Look here

Examples

use svg_definitions::prelude::*;

let path_definition_string = PathData::new()
    .move_to((3.0, 3.0))
    .r_curve_to((7.0, 7.0), (12.0, 17.0), (17.0, 22.0));

// Will output "M 3.00 3.00 c 12.00 17.00, 17.00 22.00, 7.00 7.00"
println!("{}", path_definition_string);

pub fn smooth_curve_to(self, (f32, f32), (f32, f32)) -> PathDefinitionString[src]

Appends a smooth curve (following a normal curve) to a certain point to the [PathDefinitionString], using control point 2

Note / Arguments

For further information: Look here

Examples

use svg_definitions::prelude::*;

let path_definition_string = PathData::new()
    .move_to((3.0, 3.0))
    .curve_to((10.0, 10.0), (15.0, 20.0), (20.0, 25.0))
    .smooth_curve_to((20.0, 20.0), (-5.0, -10.0));

// Will output "M 3.00 3.00 C 15.00 20.00, 20.00 25.00, 10.00 10.00 S -5.00 -10.00, 20.00 20.00"
println!("{}", path_definition_string);

pub fn r_smooth_curve_to(self, (f32, f32), (f32, f32)) -> PathDefinitionString[src]

Appends a smooth curve (following a normal curve) to a certain point relative to where the last action ended to the [PathDefinitionString], using control point 2

Note / Arguments

For further information: Look here

Examples

use svg_definitions::prelude::*;

let path_definition_string = PathData::new()
    .move_to((3.0, 3.0))
    .r_curve_to((10.0, 10.0), (15.0, 20.0), (20.0, 25.0))
    .r_smooth_curve_to((20.0, 20.0), (-5.0, -10.0));

// Will output "M 3.00 3.00 c 15.00 20.00, 20.00 25.00, 10.00 10.00 s -5.00 -10.00, 20.00 20.00"
println!("{}", path_definition_string);

pub fn quad_curve_to(self, (f32, f32), (f32, f32)) -> PathDefinitionString[src]

Appends a quadratic curve to a certain point to the [PathDefinitionString], using control point 1

Note / Arguments

For further information: Look here

Examples

use svg_definitions::prelude::*;

let path_definition_string = PathData::new()
    .move_to((3.0, 3.0))
    .quad_curve_to((10.0, 10.0), (15.0, 20.0));

// Will output "M 3.00 3.00 Q 15.00 20.00, 10.00 10.00"
println!("{}", path_definition_string);

pub fn r_quad_curve_to(self, (f32, f32), (f32, f32)) -> PathDefinitionString[src]

Appends a quadratic curve to a certain point relative to where the last action ended to the [PathDefinitionString], using control point 1

Note / Arguments

For further information: Look here

Examples

use svg_definitions::prelude::*;

let path_definition_string = PathData::new()
    .move_to((3.0, 3.0))
    .r_quad_curve_to((10.0, 10.0), (15.0, 20.0));

// Will output "M 3.00 3.00 q 15.00 20.00, 10.00 10.00"
println!("{}", path_definition_string);

pub fn quad_string_to(self, (f32, f32)) -> PathDefinitionString[src]

Appends a quadratic curve (following a quadratic curve) to a certain point to the [PathDefinitionString], smoothing out the curve using the previous quadratic curve

Note / Arguments

For further information: Look here

Examples

use svg_definitions::prelude::*;

let path_definition_string = PathData::new()
    .move_to((3.0, 3.0))
    .quad_curve_to((10.0, 10.0), (15.0, 20.0))
    .quad_string_to((20.0, 20.0));

// Will output "M 3.00 3.00 Q 15.00 20.00, 10.00 10.00 T 20.00 20.00"
println!("{}", path_definition_string);

pub fn r_quad_string_to(self, (f32, f32)) -> PathDefinitionString[src]

Appends a quadratic curve (following a quadratic curve) to a certain point relative to where the last action ended to the [PathDefinitionString], smoothing out the curve using the previous quadratic curve

Note / Arguments

For further information: Look here

Examples

use svg_definitions::prelude::*;

let path_definition_string = PathData::new()
    .move_to((3.0, 3.0))
    .r_quad_curve_to((10.0, 10.0), (15.0, 20.0))
    .r_quad_string_to((20.0, 20.0));

// Will output "M 3.00 3.00 q 15.00 20.00, 10.00 10.00 t 20.00 20.00"
println!("{}", path_definition_string);

pub fn arc_to(
    self,
    (f32, f32),
    (f64, f64),
    x_axis_rotation: f64,
    large_arc_flag: bool,
    sweep_flag: bool
) -> PathDefinitionString
[src]

Appends an arc to a certain point to the [PathDefinitionString]

Note / Arguments

For further information: Look here

Examples

use svg_definitions::prelude::*;

let path_definition_string = PathData::new()
    .move_to((5.0, 5.0))
    .arc_to((10.0, 10.0), (4.5, 8.0), 3.14, true, false);

// Will output "M 5.00 5.00 A 4.50 8.00 3.14 1 0 10.00 10.00"
println!("{}", path_definition_string);

pub fn r_arc_to(
    self,
    (f32, f32),
    (f64, f64),
    x_axis_rotation: f64,
    large_arc_flag: bool,
    sweep_flag: bool
) -> PathDefinitionString
[src]

Appends an arc to a certain point relative to where the last action ended to the [PathDefinitionString]

Note / Arguments

For further information: Look here

Examples

use svg_definitions::prelude::*;

let path_definition_string = PathData::new()
    .move_to((5.0, 5.0))
    .r_arc_to((10.0, 10.0), (4.5, 8.0), 3.14, true, false);

// Will output "M 5.00 5.00 a 4.50 8.00 3.14 1 0 10.00 10.00"
println!("{}", path_definition_string);

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

Closes a [PathDefinitionString]

Note / Arguments

For further information: Look here

Examples

use svg_definitions::prelude::*;

let path_definition_string = PathData::new()
    .move_to((0.0, 0.0))
    .line_to((10.0, 10.0))
    .line_to((10.0, 0.0))
    .close_path();

// Will output "M 0.00 0.00 L 10.00 10.00 L 10.00 0.00 Z"
println!("{}", path_definition_string);

Trait Implementations

impl Clone for PathDefinitionString[src]

impl Debug for PathDefinitionString[src]

impl Display for PathDefinitionString[src]

impl Hash for PathDefinitionString[src]

impl Into<String> for PathDefinitionString[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

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

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[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.