aboutsummaryrefslogtreecommitdiff
path: root/path/linePrinter.ml
diff options
context:
space:
mode:
Diffstat (limited to 'path/linePrinter.ml')
-rwxr-xr-xpath/linePrinter.ml53
1 files changed, 53 insertions, 0 deletions
diff --git a/path/linePrinter.ml b/path/linePrinter.ml
new file mode 100755
index 0000000..247d554
--- /dev/null
+++ b/path/linePrinter.ml
@@ -0,0 +1,53 @@
+module Repr = Layer.CanvaPrinter
+
+type t = Point.t
+
+type 'a repr =
+ { path: ('a Repr.t)
+ }
+
+let create_path
+ : 'b -> 'a repr
+ = fun _ ->
+ { path = Repr.create ()
+ }
+
+(* Start a new path. *)
+let start
+ : Point.t -> 'a repr -> 'a repr
+ = fun t {path} ->
+ let path = Repr.move_to (Point.get_coord t) path in
+ let path = Repr.line_to (Point.get_coord' t) path in
+ { path
+ }
+
+let line_to
+ : Point.t -> Point.t -> 'a repr -> 'a repr
+ = fun _ t {path} ->
+ let path = Repr.move_to (Point.get_coord t) path in
+ let path = Repr.line_to (Point.get_coord' t) path in
+ { path
+ }
+
+let quadratic_to
+ : Point.t -> Gg.v2 -> Gg.v2 -> Point.t -> 'a repr -> 'a repr
+ = fun _p0 _ctrl0 _ctrl1 p1 {path} ->
+
+ let path = Repr.move_to (Point.get_coord p1) path in
+ let path = Repr.line_to (Point.get_coord' p1) path in
+
+ { path
+ }
+
+let stop
+ : 'a repr -> 'a repr
+ = fun {path} ->
+
+
+ { path
+ }
+
+let get
+ : 'a repr -> 'a Repr.t
+ = fun {path; _} ->
+ path