use crate::pixelcolor::PixelColor;
#[derive(Debug, Copy, Clone)]
pub struct Style<P: PixelColor> {
pub fill_color: Option<P>,
pub stroke_color: Option<P>,
pub stroke_width: u8,
}
impl<P> Style<P>
where
P: PixelColor,
{
pub fn stroke(stroke_color: P) -> Self {
Self {
stroke_color: Some(stroke_color),
..Style::default()
}
}
}
impl<P> Default for Style<P>
where
P: PixelColor,
{
fn default() -> Self {
Self {
fill_color: None,
stroke_color: None,
stroke_width: 1,
}
}
}
pub trait WithStyle<C>
where
C: PixelColor,
{
fn style(self, style: Style<C>) -> Self;
fn stroke(self, stroke: Option<C>) -> Self;
fn stroke_width(self, width: u8) -> Self;
fn fill(self, stroke: Option<C>) -> Self;
}