module I:sig
..end
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.
typet =
Vg.image
val void : Vg.image
val const : Gg.color -> Vg.image
const c
is an image of color c
.
const c
]pt
= c
for any pt
.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
.
axial stops pt pt'
]q
=
[stops
]t
if q
is
on the line perpendicular to the line pt
and pt'
at
the point pt + t * (pt' - pt)
.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)
.
radial stops ~f c r
]p
=
[stops
]t
if
t
is the smallest value such that p
is
on the circle defined by radius t * r
and center f + t * (c - f)
.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
.
cut area p i
]pt
=
[i
]pt
if [a
, p
]pt
cut area p i
]pt
=
Gg.Color.void
otherwise.
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
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.
val blend : Vg.image -> Vg.image -> Vg.image
blend src dst
is src
blended over dst
using source over
destination alpha blending.
blend src dst
]p
=
Color.blend
[src
]p
[dst
]p
val move : Gg.v2 -> Vg.image -> Vg.image
move v i
is i
translated by v
.
move v i
]pt
=
[i
]pt-v
for any pt
val rot : float -> Vg.image -> Vg.image
rot a i
is i
rotated by a
.
rot a i
]pt
=
[i
]m⋅pt
for any pt
and with
m = M2.rot -a
.val scale : Gg.v2 -> Vg.image -> Vg.image
scale s i
is i
scaled by s
.
scale s i
](x,y)
=
[i
](x/s
x,y/s
y)
for any (x,y)
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
).
tr m i
]pt
=
[i
]m
-1⋅pt
for any pt
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
.
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