summaryrefslogtreecommitdiff
path: root/path/linePrinter.ml
blob: 247d5549c135e822f3a09ba35b1c788582c14210 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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