Module Private.Data

Internal data.

Path representation

type segment = [
| `Sub of Gg.p2
| `Line of Gg.p2
| `Qcurve of Gg.p2 * Gg.p2
| `Ccurve of Gg.p2 * Gg.p2 * Gg.p2
| `Earc of bool * bool * float * Gg.size2 * Gg.p2
| `Close
]

The type for path segments.

type path = segment list

The type for paths. The segment list is reversed. A few invariants apply. See the comment in Vg's source.

val of_path : P.t -> path

of_path p is the internal representation of p.

Image representation

type tr =
| Move of Gg.v2
| Rot of float
| Scale of Gg.v2
| Matrix of Gg.m3

The type for transforms. Not uniformely expressed as a matrix since renderers may have shorter syntaxes for some transforms.

val tr_to_m3 : tr -> Gg.M3.t

tr_to_m3 tr is the matrix of tr.

val inv_tr_to_m3 : tr -> Gg.M3.t

inv_tr_to_m3 tr is the matrix inverse of tr.

type blender = [
| `Atop
| `In
| `Out
| `Over
| `Plus
| `Copy
| `Xor
]
type primitive =
| Const of Gg.color
| Axial of Gg.Color.stops * Gg.p2 * Gg.p2
| Radial of Gg.Color.stops * Gg.p2 * Gg.p2 * float
| Raster of Gg.box2 * Gg.raster

The type for image primitives.

type glyph_run = {
font : font;
text : string option;
o : Gg.p2;

Unused for now, always P2.o

blocks : bool * (int * int) list;
advances : Gg.v2 list;
glyphs : glyph list;
}

The type for glyph runs.

type image =
| Primitive of primitive
| Cut of P.area * path * image
| Cut_glyphs of P.area * glyph_run * image
| Blend of blender * float option * image * image
| Tr of tr * image

The type for images.

val of_image : I.t -> image

of_image i is the internal representation of i.