Module Mlpost.Picture

module Picture: sig .. end

Functions to manipulate commands as if they were pictures


Pictures are a powerful way to reuse and modify parts of a figure

type t = Command.t 

The abstract type of pictures

val make : Command.t -> t

Make a picture from a drawing command

val tex : string -> t

Take a string in Latex format and transform it into a picture

val transform : Transform.t -> t -> t

Apply a transformation to a picture

val bbox : t -> Path.t

Get the bounding box of a picture (with default padding, as in MetaPost)

val corner_bbox : ?dx:Num.t -> ?dy:Num.t -> t -> Path.t

Get the bounding box of a picture, according to its corners and supplied padding dx and dy.

val center : Point.t -> t -> t

Place a picture centered at some point

val place_up_left : Point.t -> t -> t

Place a picture with its upper left corner at some point

val place_up_right : Point.t -> t -> t

Place a picture with its upper right corner at some point

val place_bot_left : Point.t -> t -> t

Place a picture with its bottom left corner at some point

val place_bot_right : Point.t -> t -> t

Place a picture with its bottom right corner at some point

val beside : t -> t -> t

beside p1 p2 returns a picture in which p2 is placed right to p1

val below : t -> t -> t

below p1 p2 returns a picture in which p2 is placed below p1

Special points of the bounding box of a picture

val ctr : t -> Point.t
val north : t -> Point.t
val south : t -> Point.t
val west : t -> Point.t
val east : t -> Point.t
val north_west : t -> Point.t
val south_west : t -> Point.t
val north_east : t -> Point.t
val south_east : t -> Point.t
val corner : Command.position -> t -> Point.t

Special points of the bounding box of a picture (Deprecated)

val ulcorner : t -> Point.t

These have been superseded by the preceding functions

val llcorner : t -> Point.t
val urcorner : t -> Point.t
val lrcorner : t -> Point.t
val clip : t -> Path.t -> t

clip pic path limits pic to the cyclic path path; all elements outside of path are cut off.

Dimensions

val width : t -> Num.t
val height : t -> Num.t

Predefined Transformations

val scale : Num.t -> t -> t
val rotate : float -> t -> t
val shift : Point.t -> t -> t
val yscale : Num.t -> t -> t
val xscale : Num.t -> t -> t
val spin : float -> t -> t
type escaped = [ `Backslash | `Underscore ] 
val escape_latex : escaped list -> string -> string
val escape_all : string -> string
val set_pos : Point.t -> t -> t

alias of center