aboutsummaryrefslogtreecommitdiff
path: root/path/linePrinter.ml
blob: c0a7d584989dafedda51d1b87bf0340cc37fd034 (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
54
module Make(Repr: Layer.Repr.PRINTER) = struct

  type t = Point.t

  type repr =
    { path: (Repr.t)
    }

  let create_path
    : 'b -> repr
    = fun _ ->
      { path = Repr.create ()
      }

  (* Start a new path. *)
  let start
    : Point.t -> repr -> 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 -> repr -> 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 -> repr -> 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
    : repr -> repr
    = fun {path} ->


      { path
      }

  let get
    : repr -> Repr.t
    = fun {path; _} ->
      path
end