package vg

  1. Overview
  2. Docs

Internal data.

Path representation

type segment = [
  1. | `Sub of Gg.p2
  2. | `Line of Gg.p2
  3. | `Qcurve of Gg.p2 * Gg.p2
  4. | `Ccurve of Gg.p2 * Gg.p2 * Gg.p2
  5. | `Earc of bool * bool * float * Gg.size2 * Gg.p2
  6. | `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 =
  1. | Move of Gg.v2
  2. | Rot of float
  3. | Scale of Gg.v2
  4. | 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 = [
  1. | `Atop
  2. | `In
  3. | `Out
  4. | `Over
  5. | `Plus
  6. | `Copy
  7. | `Xor
]
type primitive =
  1. | Const of Gg.color
  2. | Axial of Gg.Color.stops * Gg.p2 * Gg.p2
  3. | Radial of Gg.Color.stops * Gg.p2 * Gg.p2 * float
  4. | Raster of Gg.box2 * Gg.raster

The type for image primitives.

type glyph_run = {
  1. font : font;
  2. text : string option;
  3. o : Gg.p2;
    (*

    Unused for now, always P2.o

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

The type for glyph runs.

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

The type for images.

val of_image : I.t -> image

of_image i is the internal representation of i.