Module C2d.Path

Path2D objects.

type t

The type for Path2D objects.

val create : unit -> t

create () is a new empty path.

val of_svg : Jstr.t -> t

of_svg p is a path from the SVG path data p.

val of_path : t -> t

of_path p is a copy of p.

val add : ?⁠tr:Matrix4.t -> t -> t -> unit

add p ~tr p' adds path p' transformed by tr to p.

val close : t -> unit

close p closes path p.

val move_to : t -> x:float -> y:float -> unit

move_to p x y moves to (x,y).

val line_to : t -> x:float -> y:float -> unit

line_to p x y lines to (x,y).

val qcurve_to : t -> cx:float -> cy:float -> x:float -> y:float -> unit

qcurve_to p ~cx ~cy x y is a quadratic curve to (x,y) with control point (cx,cy).

val ccurve_to : t -> cx:float -> cy:float -> cx':float -> cy':float -> x:float -> y:float -> unit

ccurve_to p ~cx ~cy ~cx' ~cy' x y is a cubic bezier curve to (x,y) with control point (cx,cy) and (cx',cy').

val arc_to : t -> cx:float -> cy:float -> cx':float -> cy':float -> r:float -> unit

arc_to p ~cx ~cy ~cx' ~cy' r is a circular arc with control points (cx,cy), (cx',cy') and radius r.

val arc : ?⁠anticlockwise:bool -> t -> cx:float -> cy:float -> r:float -> start:float -> stop:float -> unit

arc p ~anticlockwise ~cx ~cy ~r ~start ~stop is a circular arc centered on (cx,cy) with radius r starting at angle start and stopping at stop.

val rect : t -> x:float -> y:float -> w:float -> h:float -> unit

react p x y ~w ~h is a rectangle with top-left corner (x,y) extending down by w units and right by h units (or the opposite directions with negative values).

val ellipse : ?⁠anticlockwise:bool -> t -> cx:float -> cy:float -> rx:float -> ry:float -> rot:float -> start:float -> stop:float -> unit

ellipse p ~anticlockwise ~cx ~cy ~rot ~rx ~ry ~start ~stop is an elliptical arc centered on (cx,cy) with radii (rx,ry) rotated by rot starting at angle start and stopping at stop.