Module Vg.I

module I: sig .. end
Images.

Consult their semantics.

The composition operator Vg.(>>) is used to compose images. For this reason image combinators always take the image to use as the last argument.



Images


type t = Vg.image 
The type for images.
val void : Vg.image
void is const Gg.Color.void, an invisible black image. void is an identity element for Vg.I.blend.

Primitive images


val const : Gg.color -> Vg.image
const c is an image of color c.
val axial : Gg.Color.stops -> Gg.p2 -> Gg.p2 -> Vg.image
axial stops pt pt' is an image with an axial color gradient varying between pt and pt' according to color stops stops.


val radial : Gg.Color.stops -> ?f:Gg.p2 -> Gg.p2 -> float -> Vg.image
radial stops ~f c r is an image with a color gradient varying according to color stops stops on circles whose center are on the segment from f to c and radius vary, respectively, from 0 to r. The focus f defaults to c, it must be inside the circle (c, r).



Cutting images


val cut : ?area:Vg.P.area -> Vg.path -> Vg.image -> Vg.image
cut area p i is i with the area outside [a, p] cut out, i.e. mapped to Gg.Color.void. area defaults to `Anz.

Warning. For outline cuts most renderers support only cutting into Vg.I.const Vg.I.axial and Vg.I.radial images. Consult the individual renderer documentation.

val cut_glyphs : ?area:[ `O of Vg.P.outline ] ->
?text:string ->
?blocks:bool * (int * int) list ->
?advances:Gg.v2 list -> Vg.font -> Vg.glyph list -> Vg.image -> Vg.image
WARNING. The interface and specifics of glyph rendering are still subject to change in the future.

cut_glyphs area text blocks advances font glyphs i is like Vg.I.cut except the path cut is the union of all the paths of the glyphs glyphs of the font font.

The origin of the first glyph is set to P2.o, the origin of each subsequent glyph in glyphs is offset by the advance vector of the previous glyph as provided by font. Advance vectors for each glyph can be overriden by providing their value in advances, if the length of advances is smaller than glyphs the rendering results are undefined.

If provided the text parameter indicates the UTF-8 text corresponding to the sequence of glyphs. This may be used by certain renderer to allow text search in the result or to draw the text if it lacks control over glyph rendering (in which case an empty list of glyphs may be passed).

If provided blocks is used to specify a sequential map between glyphs and the characters of text. The number of elements in the list defines the number of blocks. Starting at the head of each sequence, each block (char_adv, glyph_adv) indicates the number of characters and glyphs that make the next block (one or the other may be 0). If the boolean is true the glyph sequence is reversed for peforming the map. If blocks is unspecified a one to one map between glyphs and characters is assumed with undefined results if the number of glyphs and characters differ.

If area is provided, the outline area of the glyphs are cut as specified, otherwise the area of the glyphs is determined as mandated by the font. Warning. Backend support is poor this may be removed in the future.


Blending images


val blend : Vg.image -> Vg.image -> Vg.image
blend src dst is src blended over dst using source over destination alpha blending.

Transforming images


val move : Gg.v2 -> Vg.image -> Vg.image
move v i is i translated by v.
val rot : float -> Vg.image -> Vg.image
rot a i is i rotated by a.
val scale : Gg.v2 -> Vg.image -> Vg.image
scale s i is i scaled by s.
val tr : Gg.m3 -> Vg.image -> Vg.image
tr m i is the affine transform in homogenous 2D space of each point of i by m (see Gg.P2.tr).

Predicates and comparisons

Note. These predicates consider the structure of image values not their denotational interpretation; a single denotational interpretation can have many structural representations.

val is_void : Vg.image -> bool
is_void i is i == void.
val equal : Vg.image -> Vg.image -> bool
equal i i' is i = i'.
val equal_f : (float -> float -> bool) -> Vg.image -> Vg.image -> bool
equal eq i i' is like Vg.I.equal but uses eq to test floating point values.

Note. Raster images are tested with Gg.Raster.equal.

val compare : Vg.image -> Vg.image -> int
compare i i' is Pervasives.compare i i'.
val compare_f : (float -> float -> int) -> Vg.image -> Vg.image -> int
compare_f cmp i i' is like Vg.I.compare but uses cmp to compare floating point values.

Note. Raster images are tested with Gg.Raster.compare.


Printers


val to_string : Vg.image -> string
to_string i is a textual representation of i.
val pp : Format.formatter -> Vg.image -> unit
pp ppf i prints a textual representation of i on ppf.
val pp_f : (Format.formatter -> float -> unit) -> Format.formatter -> Vg.image -> unit
pp_f pp_float ppf i prints i like Vg.I.pp but uses pp_float to print floating point values.