[−][src]Macro embedded_graphics::egline
Create a Line
with optional styling using a
convenient macro.
Note that only the stroke
property has any effect on lines currently.
use embedded_graphics::{egline, style::Style, primitives::Line}; let line: Line<u8> = egline!((10, 20), (30, 40)); let stroke_line: Line<u8> = egline!((10, 20), (30, 40), stroke = Some(5u8));
Style properties like stroke
map to the method calls on the
WithStyle
trait. For example, the following code makes two
identical lines:
use embedded_graphics::prelude::*; use embedded_graphics::{egline, style::Style, primitives::Line}; let Line: Line<u8> = egline!((10, 20), (30, 40), stroke = Some(5u8), fill = Some(10u8)); let Line: Line<u8> = Line::new(Coord::new(10, 20), Coord::new(30, 40)) .stroke(Some(5u8)) .fill(Some(10u8));