Struct embedded_graphics::primitives::line::Line
source · pub struct Line<C: PixelColor> {
pub start: Coord,
pub end: Coord,
pub style: Style<C>,
}
Expand description
Line primitive
Fields
start: Coord
Start point
end: Coord
End point
style: Style<C>
Line style
Implementations
Trait Implementations
sourceimpl<C: Clone + PixelColor> Clone for Line<C>
impl<C: Clone + PixelColor> Clone for Line<C>
sourceimpl<C: Debug + PixelColor> Debug for Line<C>
impl<C: Debug + PixelColor> Debug for Line<C>
sourceimpl<'a, C: PixelColor> IntoIterator for &'a Line<C>
impl<'a, C: PixelColor> IntoIterator for &'a Line<C>
sourceimpl<C> Transform for Line<C>where
C: PixelColor,
impl<C> Transform for Line<C>where
C: PixelColor,
sourcefn translate(&self, by: Coord) -> Self
fn translate(&self, by: Coord) -> Self
Translate the line from its current position to a new position by (x, y) pixels, returning
a new Line
. For a mutating transform, see translate_mut
.
let line = Line::new(Coord::new(5, 10), Coord::new(15, 20))
let moved = line.translate(Coord::new(10, 10));
assert_eq!(moved.start, Coord::new(15, 20));
assert_eq!(moved.end, Coord::new(25, 30));
sourcefn translate_mut(&mut self, by: Coord) -> &mut Self
fn translate_mut(&mut self, by: Coord) -> &mut Self
Translate the line from its current position to a new position by (x, y) pixels.
let mut line = Line::new(Coord::new(5, 10), Coord::new(15, 20))
line.translate_mut(Coord::new(10, 10));
assert_eq!(line.start, Coord::new(15, 20));
assert_eq!(line.end, Coord::new(25, 30));
sourceimpl<C> WithStyle<C> for Line<C>where
C: PixelColor,
impl<C> WithStyle<C> for Line<C>where
C: PixelColor,
sourcefn with_style(self, style: Style<C>) -> Self
fn with_style(self, style: Style<C>) -> Self
Add a complete style to the object
sourcefn with_stroke(self, color: Option<C>) -> Self
fn with_stroke(self, color: Option<C>) -> Self
Set the stroke colour for the object Read more
sourcefn with_stroke_width(self, width: u8) -> Self
fn with_stroke_width(self, width: u8) -> Self
Set the stroke width for the object Read more
impl<C: Copy + PixelColor> Copy for Line<C>
impl<C> Drawable for Line<C>where
C: PixelColor,
Auto Trait Implementations
impl<C> RefUnwindSafe for Line<C>where
C: RefUnwindSafe,
impl<C> Send for Line<C>where
C: Send,
impl<C> Sync for Line<C>where
C: Sync,
impl<C> Unpin for Line<C>where
C: Unpin,
impl<C> UnwindSafe for Line<C>where
C: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more