package ocaml-canvas

  1. Overview
  2. Docs

Module V1.PathSource

Path manipulation functions

Sourcetype t

An abstract type representing a path

Sourceval create : unit -> t

create () creates an empty path object.

Sourceval moveTo : t -> Point.t -> unit

moveTo p pos moves the path p's brush position to pos.

Sourceval close : t -> unit

close p closes the path p.

Sourceval lineTo : t -> Point.t -> unit

lineTo p pos adds a straight line from the path p's brush position to pos.

Sourceval arc : t -> center:Point.t -> radius:float -> theta1:float -> theta2:float -> ccw:bool -> unit

arc p ~center ~radius ~theta1 ~theta2 ~ccw adds an arc of the given radius, centered at center, between angle theta1 to theta2 to the path p. If ccw is true, the arc will be drawn counterclockwise. Note that the last point in the subpath (if such point exists) will be connected to the first point of the arc by a straight line.

Sourceval arcTo : t -> p1:Point.t -> p2:Point.t -> radius:float -> unit

arcTo p ~p1 ~p2 ~radius adds an arc of the given radius using the control points p1 and p2 to the path p. If the path p is empty, this behaves as if moveTo p ~p:p1 was called.

Sourceval quadraticCurveTo : t -> cp:Point.t -> p:Point.t -> unit

quadraticCurveTo path ~cp ~p adds a quadratic curve from path's brush position to ~p with control point ~cp.

Sourceval bezierCurveTo : t -> cp1:Point.t -> cp2:Point.t -> p:Point.t -> unit

bezierCurveTo path ~cp1 ~cp2 ~p adds a bezier curve from path's brush position to ~p with control points ~cp1 and ~cp2.

Sourceval rect : t -> pos:Point.t -> size:Vector.t -> unit

rect p ~pos ~size adds the rectangle specified by pos and size) to the path p

Sourceval ellipse : t -> center:Point.t -> radius:Vector.t -> rotation:float -> theta1:float -> theta2:float -> ccw:bool -> unit

ellipse p ~center ~radius ~rotation ~theta1 ~theta2 adds an ellipse with the given parameters to the path p

Sourceval add : t -> t -> unit

add dst src adds the path src into the path dst

Sourceval addTransformed : t -> t -> Transform.t -> unit

addTransformed dst src t adds the path src after applying t to each of its points into the path dst

OCaml

Innovation. Community. Security.