module XDotDraw:sig
..end
Parses xdot drawing operations
See dot documentation to understand the drawing operations
typepos =
float * float
Dot layout coordinates
typewidth =
float
Dimensions
typeheight =
float
typesize =
int
type
align =
| |
Left |
| |
Center |
| |
Right |
Text alignment
type
style_attr =
| |
Filled |
| |
Invisible |
| |
Diagonals |
| |
Rounded |
| |
Dashed |
| |
Dotted |
| |
Solid |
| |
Bold |
| |
StyleString of |
Style attributes
type
operation =
| |
Filled_ellipse of |
| |
Unfilled_ellipse of |
| |
Filled_polygon of |
| |
Unfilled_polygon of |
| |
Polyline of |
| |
Bspline of |
| |
Filled_bspline of |
| |
Text of |
| |
Fill_color of |
| |
Pen_color of |
| |
Font of |
| |
Style of |
Drawing operations
val string_scale_size : string -> float -> string -> width * height
string_scale_size 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
.
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 {
|
mutable fill_color : |
|
mutable pen_color : |
|
mutable font : |
|
mutable style : |
}
val draw_with : (draw_state -> operation -> unit) ->
operation list -> unit
Iterates on the drawing operations and updates the implicit drawing state
val normalize_color : string -> string
Reads the color string and converts to rgb if in an another format