Trait buffer_graphics_lib::prelude::Shape
source · pub trait Shape {
Show 15 methods
// Required methods
fn from_points(points: &[Coord]) -> Self
where Self: Sized;
fn contains<P>(&self, point: P) -> bool
where P: Into<Coord>;
fn points(&self) -> Vec<Coord, Global>;
fn center(&self) -> Coord;
// Provided methods
fn translate_by<P>(&self, delta: P) -> Self
where P: Into<Coord>,
Self: Sized { ... }
fn move_to<P>(&self, point: P) -> Self
where P: Into<Coord>,
Self: Sized { ... }
fn move_center_to<P>(&self, point: P) -> Self
where P: Into<Coord>,
Self: Sized { ... }
fn rotate(&self, degrees: isize) -> Self
where Self: Sized { ... }
fn rotate_around<P>(&self, degrees: isize, point: P) -> Self
where P: Into<Coord>,
Self: Sized { ... }
fn left(&self) -> isize { ... }
fn right(&self) -> isize { ... }
fn top(&self) -> isize { ... }
fn bottom(&self) -> isize { ... }
fn scale(&self, factor: f32) -> Self
where Self: Sized { ... }
fn scale_around<P>(&self, factor: f32, point: P) -> Self
where P: Into<Coord>,
Self: Sized { ... }
}
Required Methods§
sourcefn from_points(points: &[Coord]) -> Selfwhere
Self: Sized,
fn from_points(points: &[Coord]) -> Selfwhere Self: Sized,
create this shape from a list of points
Provided Methods§
sourcefn translate_by<P>(&self, delta: P) -> Selfwhere
P: Into<Coord>,
Self: Sized,
fn translate_by<P>(&self, delta: P) -> Selfwhere P: Into<Coord>, Self: Sized,
change every point by +delta
sourcefn move_to<P>(&self, point: P) -> Selfwhere
P: Into<Coord>,
Self: Sized,
fn move_to<P>(&self, point: P) -> Selfwhere P: Into<Coord>, Self: Sized,
moves the shapes first point to point
(and changes every other point to match their original distance and angle)
As this moves self.points()[0] the result might be unexpected if the shape was created right to left and/or bottom to top
sourcefn move_center_to<P>(&self, point: P) -> Selfwhere
P: Into<Coord>,
Self: Sized,
fn move_center_to<P>(&self, point: P) -> Selfwhere P: Into<Coord>, Self: Sized,
moves the shapes centerto point
(and changes every other point to match their original distance and angle)
As this moves relative to self.points()[0] the result might be unexpected if the shape was created right to left and/or bottom to top
sourcefn rotate_around<P>(&self, degrees: isize, point: P) -> Selfwhere
P: Into<Coord>,
Self: Sized,
fn rotate_around<P>(&self, degrees: isize, point: P) -> Selfwhere P: Into<Coord>, Self: Sized,
rotate shape around a point