The following notations and definitions give precise meaning to images and their combinators.

The semantics of colors is the one ascribed to `Gg.color`

: colors are in a *linearized* sRGBA space.

A value of type `Gg.Color.stops`

specifies a color at each point of the 1D *unit* space. It is defined by a list of pairs `(t`

_{i}`, c`

_{i}`)`

where `t`

_{i} is a value from `0`

to `1`

and `c`

_{i} the corresponding color at that value. Colors at points between `t`

_{i} and `t`

_{i+1} are linearly interpolated between `c`

_{i} and `c`

_{i+1}. If `t`

_{i} lies outside `0`

to `1`

or if `t`

_{i-1} >= `t`

_{i} the semantics is undefined.

Given a stops value `stops = [`

`(t`

_{0}`, c`

_{0}`);`

`(t`

_{1}`,c`

_{1}`);`

... `(t`

_{n}`, c`

_{n}`)`

`]`

and any point `t`

of 1D space, the semantic function:

[] `: Gg.Color.stops -> float -> Gg.color`

maps them to a color value written [`stops`

]_{t} as follows.

- [
`stops`

]_{t}=`(0, 0, 0, 0)`

for any`t`

if`stops = []`

- [
`stops`

]_{t}`= c`

_{0}if`t < t`

_{0}. - [
`stops`

]_{t}`= c`

_{n}if`t >= t`

_{n}. - [
`stops`

]_{t}`= (1-u)c`

_{i}`+ uc`

_{i+1}with`u = (t - t`

_{i}`)/(t`

_{i+1}`-t`

_{i}`)`

if`t`

_{i}`<= t <`

`t`

_{i+1}

Values of type `Vg.image`

represent maps from the infinite 2D euclidian space to colors. Given an image `i`

and a point `pt`

of the plane the semantic function

[]`: image -> Gg.p2 -> Gg.color`

maps them to a color value written [`i`

]_{pt} representing the image's color at this point.

A value of type `Vg.path`

is a list of subpaths. A subpath is a list of *directed* and connected curved *segments*. Subpaths are disconnected from each other and may (self-)intersect.

A path and an area specification of type `Vg.P.area`

define a finite area of the 2D euclidian space. Given an area specification `a`

, a path `p`

and a point `pt`

, the semantic function:

[]: `P.area -> path -> Gg.p2 -> bool`

maps them to a boolean value written [`a`

, `p`

]_{pt} that indicates whether `pt`

belongs to the area or not.

The semantics of area rules is as follows:

- [
``Anz`

,`p`

]_{pt}is`true`

iff the winding number of`p`

around`pt`

is non zero. To determine the winding number cast a ray from`pt`

to infinity in any direction (just make sure the ray doesn't intersect`p`

tangently or at a singularity). Starting with zero add one for each intersection with a counter-clockwise oriented segment of`p`

and substract one for each clockwise ones. The resulting sum is the winding number. This is usually refered to as the*non-zero winding rule*and is the default for`Vg.I.cut`

. - [
``Aeo`

,`p`

]_{pt}is`true`

iff the number of intersections of`p`

with a ray cast from`pt`

to infinity in any direction is odd (just make sure the ray doesn't intersect`p`

tangently or at a singularity). This is usually refered to as the*even-odd rule*. - [
``O o`

,`p`

]_{pt}is`true`

iff`pt`

is in the outline area of`p`

as defined by the value`o`

of type`Vg.P.outline`

. See Outline areas, Segment jointures, Subpath caps, Outline dashes.

The outline area of a path specified by a value `o`

of type `Vg.P.outline`

is the union of its subpaths outline areas.

A subpath outline area is inside the parallel curves at a distance `o.width / 2`

of its path segments that are joined accoring to the join style `o.join`

(see below) and closed at the subpath end points with a cap style `o.cap`

(see below). The outline area of a subpath can also be chopped at regular intervals according to the `o.dashes`

parameter (see below).

The shape of subpath segment jointures is specified in `o.join`

by a value of type `Vg.P.join`

. From left to right:

``Miter`

, the outer parallel curves are extended until they meet unless the joining angle is smaller than`o.miter_angle`

in which case the join is converted to a bevel.``Round`

, joins the outer parallel curves by a semicircle centered at the end point with a diameter equal to`o.width`

.``Bevel`

, joins the outer parallel curves by a segment.

The shape of subpath (or dashes) end points is specified in `o.cap`

by a value of type `Vg.P.cap`

. From left to right:

``Butt`

, end points are square and extend only to the exact end point of the path.``Round`

, end points are rounded by a semicircle at the end point with a diameter equal to`o.width`

.``Square`

, end points are square and extend by a distance equal to half`o.width`

.

The path outline area can be chopped at regular intervals by specifying a value `(off, pat)`

of type `Vg.P.dashes`

in `o.dashes`

.

The *dash pattern* `pat`

is a list of lengths that specify the length of alternating dashes and gaps (starting with dashes). The *dash offset* `off`

is a *positive* offset that indicates where to start in the dash pattern at the beginning of a subpath.