summaryrefslogtreecommitdiff
path: root/src/geom/path.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/geom/path.rs')
-rw-r--r--src/geom/path.rs54
1 files changed, 0 insertions, 54 deletions
diff --git a/src/geom/path.rs b/src/geom/path.rs
deleted file mode 100644
index 1c5325a3..00000000
--- a/src/geom/path.rs
+++ /dev/null
@@ -1,54 +0,0 @@
-use super::*;
-
-/// A bezier path.
-#[derive(Debug, Default, Clone, Eq, PartialEq, Hash)]
-pub struct Path(pub Vec<PathItem>);
-
-/// An item in a bezier path.
-#[derive(Debug, Clone, Eq, PartialEq, Hash)]
-pub enum PathItem {
- MoveTo(Point),
- LineTo(Point),
- CubicTo(Point, Point, Point),
- ClosePath,
-}
-
-impl Path {
- /// Create an empty path.
- pub const fn new() -> Self {
- Self(vec![])
- }
-
- /// Create a path that describes a rectangle.
- pub fn rect(size: Size) -> Self {
- let z = Abs::zero();
- let point = Point::new;
- let mut path = Self::new();
- path.move_to(point(z, z));
- path.line_to(point(size.x, z));
- path.line_to(point(size.x, size.y));
- path.line_to(point(z, size.y));
- path.close_path();
- path
- }
-
- /// Push a [`MoveTo`](PathItem::MoveTo) item.
- pub fn move_to(&mut self, p: Point) {
- self.0.push(PathItem::MoveTo(p));
- }
-
- /// Push a [`LineTo`](PathItem::LineTo) item.
- pub fn line_to(&mut self, p: Point) {
- self.0.push(PathItem::LineTo(p));
- }
-
- /// Push a [`CubicTo`](PathItem::CubicTo) item.
- pub fn cubic_to(&mut self, p1: Point, p2: Point, p3: Point) {
- self.0.push(PathItem::CubicTo(p1, p2, p3));
- }
-
- /// Push a [`ClosePath`](PathItem::ClosePath) item.
- pub fn close_path(&mut self) {
- self.0.push(PathItem::ClosePath);
- }
-}