Struct rin::graphics::path::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]
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]
C: ToRgba,
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]
C: ToRgba,
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]
&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>
)
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]
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,
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]
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,
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>ⓘ 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]
&self,
resolution: u32
) -> Vec<Polyline<<Point as NumPnt>::Field>, Global>ⓘ 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,
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]
&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,
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]
&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,
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> 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]
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]pub fn from_iter<T>(commands: T) -> Path2D<Point> where
T: IntoIterator<Item = Command<Point>>,
[src]
T: IntoIterator<Item = Command<Point>>,
Auto Trait Implementations
impl<Point> RefUnwindSafe for Path2D<Point> where
Point: RefUnwindSafe,
<Point as NumPnt>::Field: RefUnwindSafe,
Point: RefUnwindSafe,
<Point as NumPnt>::Field: RefUnwindSafe,
impl<Point> Send for Path2D<Point> where
Point: Send,
Point: Send,
impl<Point> Sync for Path2D<Point> where
Point: Sync,
Point: Sync,
impl<Point> Unpin for Path2D<Point> where
Point: Unpin,
<Point as NumPnt>::Field: Unpin,
Point: Unpin,
<Point as NumPnt>::Field: Unpin,
impl<Point> UnwindSafe for Path2D<Point> where
Point: UnwindSafe,
<Point as NumPnt>::Field: UnwindSafe,
Point: UnwindSafe,
<Point as NumPnt>::Field: UnwindSafe,
Blanket Implementations
impl<T> DowncastSync for T where
T: Any + Send + Sync,
[src]
impl<T> DowncastSync for T where
T: Any + Send + Sync,
[src]impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]pub fn to_subset(&self) -> Option<SS>
[src]
pub fn is_in_subset(&self) -> bool
[src]
pub fn to_subset_unchecked(&self) -> SS
[src]
pub fn from_subset(element: &SS) -> SP
[src]
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]