| 1 | mod closed_thick_segment_iter; |
| 2 | mod distance_iterator; |
| 3 | mod line_join; |
| 4 | mod linear_equation; |
| 5 | mod plane_sector; |
| 6 | mod scanline; |
| 7 | mod styled_scanline; |
| 8 | mod thick_segment; |
| 9 | mod thick_segment_iter; |
| 10 | |
| 11 | pub use closed_thick_segment_iter::ClosedThickSegmentIter; |
| 12 | pub use distance_iterator::DistanceIterator; |
| 13 | pub use line_join::{JoinKind, LineJoin}; |
| 14 | pub use linear_equation::{LinearEquation, OriginLinearEquation, NORMAL_VECTOR_SCALE}; |
| 15 | pub use plane_sector::PlaneSector; |
| 16 | pub use scanline::Scanline; |
| 17 | pub use styled_scanline::StyledScanline; |
| 18 | pub use thick_segment::ThickSegment; |
| 19 | pub use thick_segment_iter::ThickSegmentIter; |
| 20 | |
| 21 | use crate::primitives::StrokeAlignment; |
| 22 | |
| 23 | #[derive (Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)] |
| 24 | #[cfg_attr (feature = "defmt" , derive(::defmt::Format))] |
| 25 | pub enum StrokeOffset { |
| 26 | /// Stroke is centered around the line skeleton. |
| 27 | None, |
| 28 | |
| 29 | /// Stroke is offset to the left of the line. |
| 30 | Left, |
| 31 | |
| 32 | /// Stroke is offset to the right of the line. |
| 33 | Right, |
| 34 | } |
| 35 | |
| 36 | impl From<StrokeAlignment> for StrokeOffset { |
| 37 | fn from(alignment: StrokeAlignment) -> Self { |
| 38 | match alignment { |
| 39 | StrokeAlignment::Inside => Self::Right, |
| 40 | StrokeAlignment::Outside => Self::Left, |
| 41 | StrokeAlignment::Center => Self::None, |
| 42 | } |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | /// Which side of the center line to draw on. |
| 47 | /// |
| 48 | /// Imagine standing on `start`, looking ahead to where `end` is. `Left` is to your left, `Right` to |
| 49 | /// your right. |
| 50 | #[derive (Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)] |
| 51 | #[cfg_attr (feature = "defmt" , derive(::defmt::Format))] |
| 52 | pub enum LineSide { |
| 53 | /// Left side of the line |
| 54 | Left, |
| 55 | |
| 56 | /// Right side of the line |
| 57 | Right, |
| 58 | } |
| 59 | |
| 60 | impl LineSide { |
| 61 | /// Swap side. |
| 62 | pub const fn swap(self) -> Self { |
| 63 | match self { |
| 64 | Self::Left => Self::Right, |
| 65 | Self::Right => Self::Left, |
| 66 | } |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | /// Point type. |
| 71 | #[derive (Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)] |
| 72 | #[cfg_attr (feature = "defmt" , derive(::defmt::Format))] |
| 73 | pub enum PointType { |
| 74 | /// Represents part of the stroke. |
| 75 | Stroke, |
| 76 | |
| 77 | /// Represents the interior of the shape. |
| 78 | Fill, |
| 79 | } |
| 80 | |