[−][src]Struct embedded_graphics::primitives::line::Line
Line primitive
Examples
The macro examples make for more concise code.
Create some lines with different styles
use embedded_graphics::{ pixelcolor::Rgb565, prelude::*, primitives::Line, style::PrimitiveStyle, }; // Red 1 pixel wide line from (50, 20) to (60, 35) Line::new(Point::new(50, 20), Point::new(60, 35)) .into_styled(PrimitiveStyle::with_stroke(Rgb565::RED, 1)) .draw(&mut display)?; // Green 1 pixel wide line with translation applied Line::new(Point::new(50, 20), Point::new(60, 35)) .translate(Point::new(65, 35)) .into_styled(PrimitiveStyle::with_stroke(Rgb565::GREEN, 1)) .draw(&mut display)?;
Fields
start: Point
Start point
end: Point
End point
Methods
impl Line
[src]
Trait Implementations
impl Clone for Line
[src]
fn clone(&self) -> Line
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for Line
[src]
impl Debug for Line
[src]
impl Default for Line
[src]
impl Dimensions for Line
[src]
impl Eq for Line
[src]
impl Hash for Line
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for Line
[src]
fn cmp(&self, other: &Line) -> Ordering
[src]
#[must_use]
fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]
fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]
fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<Line> for Line
[src]
impl PartialOrd<Line> for Line
[src]
fn partial_cmp(&self, other: &Line) -> Option<Ordering>
[src]
fn lt(&self, other: &Line) -> bool
[src]
fn le(&self, other: &Line) -> bool
[src]
fn gt(&self, other: &Line) -> bool
[src]
fn ge(&self, other: &Line) -> bool
[src]
impl Primitive for Line
[src]
fn into_styled<C>(
self,
style: PrimitiveStyle<C>
) -> Styled<Self, PrimitiveStyle<C>> where
C: PixelColor,
Self: Sized,
[src]
self,
style: PrimitiveStyle<C>
) -> Styled<Self, PrimitiveStyle<C>> where
C: PixelColor,
Self: Sized,
impl StructuralEq for Line
[src]
impl StructuralPartialEq for Line
[src]
impl Transform for Line
[src]
fn translate(&self, by: Point) -> Self
[src]
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(Point::new(5, 10), Point::new(15, 20)); let moved = line.translate(Point::new(10, 10)); assert_eq!(moved.start, Point::new(15, 20)); assert_eq!(moved.end, Point::new(25, 30));
fn translate_mut(&mut self, by: Point) -> &mut Self
[src]
Translate the line from its current position to a new position by (x, y) pixels.
let mut line = Line::new(Point::new(5, 10), Point::new(15, 20)); line.translate_mut(Point::new(10, 10)); assert_eq!(line.start, Point::new(15, 20)); assert_eq!(line.end, Point::new(25, 30));
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> Scalar for T where
T: PartialEq<T> + Copy + Any + Debug,
[src]
T: PartialEq<T> + Copy + Any + Debug,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn is_in_subset(&self) -> bool
unsafe fn to_subset_unchecked(&self) -> SS
fn from_subset(element: &SS) -> SP
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,