Struct rin::graphics::Path2D[][src]

pub struct Path2D<Point = Point<f32, U2>> where
    Point: FloatPnt + Copy,
    <Point as NumPnt>::Field: RealField,
    <Point as NumPnt>::Field: Copy,
    <Point as NumPnt>::Coordinates: Neg,
    <<Point as NumPnt>::Coordinates as Neg>::Output == <Point as NumPnt>::Coordinates
{ /* fields omitted */ }

Represents a 2D path using commands that can be later decomposed into line segments if the renderer requires it

The path uses a cursor that can be moved or told to draw a specific line, curve or other shape.IntoIterator

The starting point for the next primitive will be the last point of the previous one

Implementations

impl<Point> Path2D<Point> where
    Point: FloatPnt + Copy,
    <Point as NumPnt>::Field: RealField,
    <Point as NumPnt>::Field: Copy,
    <Point as NumPnt>::Coordinates: Neg,
    <<Point as NumPnt>::Coordinates as Neg>::Output == <Point as NumPnt>::Coordinates
[src]

pub fn new() -> Path2D<Point>[src]

pub fn set_line_width(&mut self, w: f32)[src]

Line width (some renderers might not support line widths different than 1)

pub fn line_width(&self) -> f32[src]

pub fn set_line_cap(&mut self, cap: LineCap)[src]

Line caps

pub fn line_cap(&self) -> LineCap[src]

pub fn set_line_color<C>(&mut self, c: &C) where
    C: ToRgba
[src]

Sets the color of the contours and lines or curves

pub fn line_color(&self) -> AlphaColor<f32, Rgb<f32, Srgb>>[src]

pub fn set_fill_color<C>(&mut self, c: &C) where
    C: ToRgba
[src]

Sets the color of the shapes fill

pub fn fill_color(&self) -> AlphaColor<f32, Rgb<f32, Srgb>>[src]

pub fn move_to(&mut self, to: Point)[src]

Moves the cursor

pub fn line_to(&mut self, to: Point)[src]

Draws a line segment from the last postion to to

pub fn bezier_to(&mut self, cp1: Point, cp2: Point, to: Point)[src]

Draws a cubic bezier curve from the last position to to using the control points cp1 and cp2

pub fn quad_bezier_to(&mut self, cp1: Point, to: Point)[src]

Draws a quadratic bezier curve from the last position to to using the control point cp1

pub fn catmull_rom_to(&mut self, to: Point)[src]

Draws a hermite spine from the last point to `to

For this to show anything there needs to be at least 4 curve_to points

pub fn arc(
    &mut self,
    center: Point,
    w: <Point as NumPnt>::Field,
    h: <Point as NumPnt>::Field,
    init_angle: Deg<<Point as NumPnt>::Field>,
    angle: Deg<<Point as NumPnt>::Field>
)
[src]

Draws an arc segment from the center

As an exception to other primitives this doesn’t start from the last point but from the center passed as an argument

pub fn close(&mut self)[src]

Join the last and first points in the path

pub fn append(&mut self, path: Path2D<Point>)[src]

Add a path to this one

pub fn clear(&mut self)[src]

Clear the path

pub fn is_empty(&self) -> bool[src]

Returns true if the path doesn’t contain any commands

pub fn push_command(&mut self, command: Command<Point>)[src]

pub fn to_lines<F>(&self, resolution: u32, f: F) where
    F: FnMut(Point, Point, bool),
    Point: Copy,
    <Point as NumPnt>::Coordinates: Neg,
    <Point as NumPnt>::Coordinates: Copy,
    <Point as NumPnt>::Coordinates: ToPnt<Point>,
    <Point as NumPnt>::Field: RealField,
    <Point as NumPnt>::Field: Float,
    <Point as NumPnt>::Field: NumCast,
    <<Point as NumPnt>::Coordinates as Neg>::Output == <Point as NumPnt>::Coordinates
[src]

Converts the path contour into line segments using the passed resolution when converting curves or arcs

This function will call the passed callback for every point in the decomposition passing the previous point, the current point and a boolean indicating if the shape should be closed or not

pub fn to_line_strips<F>(&self, resolution: u32, f: F) where
    F: FnMut(Point, bool),
    Point: Copy,
    <Point as NumPnt>::Coordinates: Neg,
    <Point as NumPnt>::Coordinates: Copy,
    <Point as NumPnt>::Coordinates: ToPnt<Point>,
    <Point as NumPnt>::Field: Float,
    <Point as NumPnt>::Field: NumCast,
    <<Point as NumPnt>::Coordinates as Neg>::Output == <Point as NumPnt>::Coordinates
[src]

Similar tp to_lines but using a line_strip kind of primitive type

The passed callback receives the next point and if it should close the shape as a boolean

pub fn to_polylines(
    &self,
    resolution: u32
) -> Vec<Polyline<<Point as NumPnt>::Field>, Global>

Notable traits for Vec<u8, A>

impl<A> Write for Vec<u8, A> where
    A: Allocator
where
    Point: Swizzles2<<Point as NumPnt>::Field, Swizzle2 = Point<<Point as NumPnt>::Field, U2>> + Copy,
    <Point as NumPnt>::Coordinates: Copy,
    <Point as NumPnt>::Coordinates: ToPnt<Point>,
    <Point as NumPnt>::Field: NumCast,
    <Point as NumPnt>::Field: RealField,
    <Point as NumPnt>::Field: Float
[src]

pub fn to_outline_mesh(
    &self,
    curve_resolution: u32
) -> Mesh<<Point as NumPnt>::Coordinates> where
    Point: Copy,
    <Point as NumPnt>::Field: Float,
    <Point as NumPnt>::Field: NumCast,
    <Point as NumPnt>::Coordinates: Neg,
    <Point as NumPnt>::Coordinates: Copy,
    <Point as NumPnt>::Coordinates: ToPnt<Point>,
    <<Point as NumPnt>::Coordinates as Neg>::Output == <Point as NumPnt>::Coordinates
[src]

Returns a mesh with the full outline of the path

pub fn to_fill_mesh(
    &self,
    curve_resolution: u32
) -> Mesh<<Point as NumPnt>::Coordinates> where
    Point: Copy,
    <Point as NumPnt>::Field: Float,
    <Point as NumPnt>::Field: NumCast,
    <Point as NumPnt>::Coordinates: Neg,
    <Point as NumPnt>::Coordinates: Copy,
    <Point as NumPnt>::Coordinates: ToPnt<Point>,
    <<Point as NumPnt>::Coordinates as Neg>::Output == <Point as NumPnt>::Coordinates
[src]

Returns a mesh with the fill of the mesh

This fill is not tesselated and should be drawn using a stencil buffer

Trait Implementations

impl<Point> Clone for Path2D<Point> where
    Point: Clone + FloatPnt + Copy,
    <Point as NumPnt>::Field: RealField,
    <Point as NumPnt>::Field: Copy,
    <Point as NumPnt>::Coordinates: Neg,
    <<Point as NumPnt>::Coordinates as Neg>::Output == <Point as NumPnt>::Coordinates
[src]

impl<Point> FromIterator<Command<Point>> for Path2D<Point> where
    Point: FloatPnt + Copy,
    <Point as NumPnt>::Field: RealField,
    <Point as NumPnt>::Field: Copy,
    <Point as NumPnt>::Coordinates: Neg,
    <<Point as NumPnt>::Coordinates as Neg>::Output == <Point as NumPnt>::Coordinates
[src]

Auto Trait Implementations

impl<Point> RefUnwindSafe for Path2D<Point> where
    Point: RefUnwindSafe,
    <Point as NumPnt>::Field: RefUnwindSafe

impl<Point> Send for Path2D<Point> where
    Point: Send

impl<Point> Sync for Path2D<Point> where
    Point: Sync

impl<Point> Unpin for Path2D<Point> where
    Point: Unpin,
    <Point as NumPnt>::Field: Unpin

impl<Point> UnwindSafe for Path2D<Point> where
    Point: UnwindSafe,
    <Point as NumPnt>::Field: UnwindSafe

Blanket Implementations

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

impl<T> Any for T where
    T: Any
[src]

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

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

impl<T> Downcast for T where
    T: Any
[src]

impl<T> DowncastSync for T where
    T: Any + Send + Sync
[src]

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

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

impl<V> IntoPnt<V> for V[src]

impl<V> IntoVec<V> for V[src]

impl<T> Pointable for T[src]

type Init = T

The type for initializers.

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

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 
[src]

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 
[src]

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

type Owned = T

The resulting type after obtaining ownership.

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<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]