pub struct Path { /* private fields */ }Expand description
A path built from lines and curves: Compose’s Path.
Example: a sparkline, stroked by crate::DrawScope::draw_path:
use cranpose_ui_graphics::{Path, Point};
let mut path = Path::new();
path.move_to(Point::new(0.0, 10.0));
path.line_to(Point::new(10.0, 4.0));
path.quadratic_to(Point::new(15.0, 0.0), Point::new(20.0, 6.0));
assert_eq!(path.contours().len(), 1);Implementations§
Source§impl Path
impl Path
Sourcepub fn quadratic_to(&mut self, control: Point, end: Point)
pub fn quadratic_to(&mut self, control: Point, end: Point)
Adds the quadratic curve from the pen through control to end:
Compose’s quadraticTo.
Sourcepub fn cubic_to(&mut self, first: Point, second: Point, end: Point)
pub fn cubic_to(&mut self, first: Point, second: Point, end: Point)
Adds the cubic curve from the pen through first and second to
end: Compose’s cubicTo.
Sourcepub fn close(&mut self)
pub fn close(&mut self)
Closes the current contour back to its first point; the next edge starts a new contour there.
Sourcepub fn contours(&self) -> &[PathContour]
pub fn contours(&self) -> &[PathContour]
The contours, each flattened to points.
Sourcepub fn bounds(&self) -> Rect
pub fn bounds(&self) -> Rect
The box of every point, or an empty rect at the origin for an empty path.
Sourcepub fn to_vector_path(&self, fill_rule: PathFillRule) -> VectorPath
pub fn to_vector_path(&self, fill_rule: PathFillRule) -> VectorPath
The path as a fill: every contour closed, under fill_rule.
Trait Implementations§
impl StructuralPartialEq for Path
Auto Trait Implementations§
impl Freeze for Path
impl RefUnwindSafe for Path
impl Send for Path
impl Sync for Path
impl Unpin for Path
impl UnsafeUnpin for Path
impl UnwindSafe for Path
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more