Skip to main content

PathCore

Trait PathCore 

Source
pub trait PathCore {
    // Required methods
    fn current(&self) -> Point;
    fn move_to_impl(&mut self, to: Point) -> &mut Self;
    fn line_to_impl(&mut self, to: Point) -> &mut Self;
    fn quadratic_to_impl(&mut self, c1: Point, to: Point) -> &mut Self;
    fn cubic_to_impl(&mut self, c1: Point, c2: Point, to: Point) -> &mut Self;
    fn close(&mut self) -> &mut Self;

    // Provided methods
    fn move_to(&mut self, to: impl Into<Point>) -> &mut Self { ... }
    fn line_to(&mut self, to: impl Into<Point>) -> &mut Self { ... }
    fn quadratic_to(
        &mut self,
        c1: impl Into<Point>,
        to: impl Into<Point>,
    ) -> &mut Self { ... }
    fn cubic_to(
        &mut self,
        c1: impl Into<Point>,
        c2: impl Into<Point>,
        to: impl Into<Point>,
    ) -> &mut Self { ... }
}
Expand description

Core trait for building path objects in vector graphics.

Required Methods§

Source

fn current(&self) -> Point

Returns the current position in the path.

Source

fn move_to_impl(&mut self, to: Point) -> &mut Self

Source

fn line_to_impl(&mut self, to: Point) -> &mut Self

Source

fn quadratic_to_impl(&mut self, c1: Point, to: Point) -> &mut Self

Source

fn cubic_to_impl(&mut self, c1: Point, c2: Point, to: Point) -> &mut Self

Source

fn close(&mut self) -> &mut Self

Closes the current sub-path by drawing a straight line back to the starting point.

Provided Methods§

Source

fn move_to(&mut self, to: impl Into<Point>) -> &mut Self

Moves the current position to the specified point.

Source

fn line_to(&mut self, to: impl Into<Point>) -> &mut Self

Draws a straight line from the current position to the specified point.

Source

fn quadratic_to( &mut self, c1: impl Into<Point>, to: impl Into<Point>, ) -> &mut Self

Draws a quadratic Bézier curve from the current position to the specified point with the given control point.

Source

fn cubic_to( &mut self, c1: impl Into<Point>, c2: impl Into<Point>, to: impl Into<Point>, ) -> &mut Self

Draws a cubic Bézier curve from the current position to the specified point with the given control points.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl PathCore for &mut Vec<PathCmd>

Implementation of PathCore for mutable reference to Vec Allows building paths by appending PathCmd elements to a vector.

Source§

fn current(&self) -> Point

Source§

fn move_to_impl(&mut self, to: Point) -> &mut Self

Source§

fn line_to_impl(&mut self, to: Point) -> &mut Self

Source§

fn quadratic_to_impl(&mut self, c1: Point, to: Point) -> &mut Self

Source§

fn cubic_to_impl(&mut self, c1: Point, c2: Point, to: Point) -> &mut Self

Source§

fn close(&mut self) -> &mut Self

Source§

impl<'a, 'b> PathCore for (&'a mut Vec<PathVerb>, &'b mut Vec<Point>)

Implementation of PathCore for a tuple of verb and point vectors Separates path verbs from their associated points for efficient storage.

Source§

fn current(&self) -> Point

Source§

fn move_to_impl(&mut self, to: Point) -> &mut Self

Source§

fn line_to_impl(&mut self, to: Point) -> &mut Self

Source§

fn quadratic_to_impl(&mut self, c1: Point, to: Point) -> &mut Self

Source§

fn cubic_to_impl(&mut self, c1: Point, c2: Point, to: Point) -> &mut Self

Source§

fn close(&mut self) -> &mut Self

Implementors§

Source§

impl PathCore for Path

Source§

impl<P: FixedCore> PathCore for FixedPath<P>

Source§

impl<const V: usize, const P: usize> PathCore for ArrayPath<V, P>