package ocamlgraph

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Parses xdot drawing operations

See dot documentation to understand the drawing operations

Types

type pos = float * float

Dot layout coordinates

type width = float

Dimensions

type height = float
type size = int
type align =
  1. | Left
  2. | Center
  3. | Right

Text alignment

type style_attr =
  1. | Filled
  2. | Invisible
  3. | Diagonals
  4. | Rounded
  5. | Dashed
  6. | Dotted
  7. | Solid
  8. | Bold
  9. | StyleString of string

Style attributes

type operation =
  1. | Filled_ellipse of pos * width * height
  2. | Unfilled_ellipse of pos * width * height
  3. | Filled_polygon of pos array
  4. | Unfilled_polygon of pos array
  5. | Polyline of pos array
  6. | Bspline of pos array
  7. | Filled_bspline of pos array
  8. | Text of pos * align * width * string
  9. | Fill_color of string
  10. | Pen_color of string
  11. | Font of float * string
  12. | Style of style_attr list

Drawing operations

val string_scale_size : fontMeasure:(fontName:string -> fontSize:int -> string -> int * int) -> string -> float -> string -> width * height

string_scale_size ~fontMeasure font font_size text. Interpolates the font metrics we have to use to draw the given text with the given font but preserving the bounding box of the text even with a proportional font. For a fixed width font the result is font_size*font_size.

Parsing and drawing state

Parses an xdot drawing attribute

val parse : string -> operation list

Some drawing operations modify the following drawing state (pen_color, font and style).

type draw_state = private {
  1. mutable fill_color : string;
  2. mutable pen_color : string;
  3. mutable font : float * string;
  4. mutable style : style_attr list;
}
val draw_with : (draw_state -> operation -> unit) -> operation list -> unit

Iterates on the drawing operations and updates the implicit drawing state

Miscellaneous

val normalize_color : string -> string

Reads the color string and converts to rgb if in an another format

OCaml

Innovation. Community. Security.