[−][src]Macro embedded_graphics::egtriangle
Create a Triangle
with optional styling using a
convenient macro.
use embedded_graphics::{egtriangle, style::Style, primitives::Triangle}; let empty_triangle: Triangle<u8> = egtriangle!((10, 20), (30, 40), (50, 60)); let filled_triangle: Triangle<u8> = egtriangle!((10, 20), (30, 40), (50, 60), stroke = Some(5u8), fill = Some(10u8)); let triangle_default_style: Triangle<u8> = egtriangle!((10, 20), (30, 40), (50, 60), style = Style::default());
Style properties like stroke
map to the method calls on the
WithStyle
trait. For example, the following code makes two
identical triangles:
use embedded_graphics::prelude::*; use embedded_graphics::{egtriangle, style::Style, primitives::Triangle}; let Triangle: Triangle<u8> = egtriangle!((10, 20), (30, 40), (50, 60), stroke = Some(5u8), fill = Some(10u8)); let Triangle: Triangle<u8> = Triangle::new(Coord::new(10, 20), Coord::new(30, 40), Coord::new(50, 60)) .stroke(Some(5u8)) .fill(Some(10u8));