diff options
Diffstat (limited to 'src/geom')
| -rw-r--r-- | src/geom/paint.rs | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/geom/paint.rs b/src/geom/paint.rs index 3660d528..351ef443 100644 --- a/src/geom/paint.rs +++ b/src/geom/paint.rs @@ -5,7 +5,7 @@ use syntect::highlighting::Color as SynColor; use super::*; /// How a fill or stroke should be painted. -#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +#[derive(Copy, Clone, Eq, PartialEq, Hash)] pub enum Paint { /// A solid color. Solid(Color), @@ -20,6 +20,14 @@ where } } +impl Debug for Paint { + fn fmt(&self, f: &mut Formatter) -> fmt::Result { + match self { + Self::Solid(color) => color.fmt(f), + } + } +} + /// A color in a dynamic format. #[derive(Copy, Clone, Eq, PartialEq, Hash)] pub enum Color { @@ -234,6 +242,24 @@ impl From<CmykColor> for Color { } } +/// A stroke of a geometric shape. +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +pub struct Stroke { + /// The stroke's paint. + pub paint: Paint, + /// The stroke's thickness. + pub thickness: Length, +} + +impl Default for Stroke { + fn default() -> Self { + Self { + paint: Paint::Solid(Color::BLACK.into()), + thickness: Length::pt(1.0), + } + } +} + #[cfg(test)] mod tests { use super::*; |
