Draft: Vg proto
A very simple way of integrating Vg support that could be used as a starting point. Credit goes to Etienne Marais.
Try it for example with the following snippet (taken from the Vg demos):
open Gg
open Vg
let arrowhead n =
let arrowhead_path i len =
let angle = Float.pi /. 3. in
let rec loop i len sign turn p =
if i = 0 then p |> P.line ~rel:true V2.(polar len turn) else
p |>
loop (i - 1) (len /. 2.) (-. sign) (turn +. sign *. angle) |>
loop (i - 1) (len /. 2.) sign turn |>
loop (i - 1) (len /. 2.) (-. sign) (turn -. sign *. angle)
in
P.empty |> loop i len 1. 0.
in
let area = `O { P.o with P.width = 0.005 } in
I.const Color.black
|> I.cut ~area (arrowhead_path n 0.8)
|> I.move (V2.v 0. 0.1)
;;
arrowhead 7