package mlpost

  1. Overview
  2. Docs

Basic drawing commands

General Commands to build figures

type t

The abstract commands type

Drawing Commands

val draw : ?brush:Brush.t -> ?color:Color.t -> ?pen:Pen.t -> ?dashed:Dash.t -> Path.t -> t

Draw a path

  • parameter color

    the color of the path; default is black

  • parameter pen

    the pen used to draw the path; default is Brush.Pen.default

  • parameter dashed

    if given, the path is drawn using that dash_style.

val fill : ?color:Color.t -> Path.t -> t

Fill a contour given by a closed path

  • parameter color

    the color used to fill the area; default is black

val draw_pic : Picture.t -> t

draws a picture

val externalimage : string -> [ `None | `Width of Num.t | `Height of Num.t | `Inside of Num.t * Num.t | `Exact of Num.t * Num.t ] -> t

insert an image given its filename - *EXPERIMENTAL*

Manipulating Commands

val nop : t

A command that has no effect

val append : t -> t -> t

Append two commands to form a compound command

val (++) : t -> t -> t

Abbreviation for append

val seq : t list -> t

Group a list of commands to a single command

val iter : int -> int -> (int -> t) -> t

iter m n f builds a command that corresponds to the sequence of commands f m; f (m+1); ... ; f(n)

val iterl : ('a -> t) -> 'a list -> t

iterl f l builds a command that corresponds to the sequence of commands f x1; f x2; ... ; f xn for l = [x1;x2;...;xn]

Labels

type hposition = [
  1. | `Center
  2. | `West
  3. | `East
  4. | `Left
  5. | `Right
]
type vposition = [
  1. | `Center
  2. | `North
  3. | `South
  4. | `Top
  5. | `Bot
  6. | `Bottom
]
type position = [
  1. | hposition
  2. | vposition
  3. | `Northwest
  4. | `Northeast
  5. | `Southwest
  6. | `Southeast
  7. | `Upperleft
  8. | `Upperright
  9. | `Lowerleft
  10. | `Lowerright
  11. | `Topleft
  12. | `Topright
  13. | `Bottomleft
  14. | `Bottomright
  15. | `Upleft
  16. | `Upright
  17. | `Lowleft
  18. | `Lowright
]

Positions - they are used at many places in Mlpost to indicate a direction or position.

val label : ?pos:position -> Picture.t -> Point.t -> t

label ~pos:`West pic p puts picture pic at the left of the point p

val dotlabel : ?pos:position -> Picture.t -> Point.t -> t

Works like label, but puts a dot at point p as well

OCaml

Innovation. Community. Security.