Module Hugin_vg_instances.Instances
The rules of stamps that every renderer follows: which instances show and which colours they paint with, and the walks of a stamp's picture that decide them.
An instance of a stamp paints the stamp's picture scaled and moved to its position, with the picture's pens: whatever its scale, its strokes reach as far beyond their paths as the picture's do.
val everywhere : Hugin_gg.Box2.teverywhere is the box from -1e15 to 1e15 along both axes.
val bounds : Hugin_vg.Picture.t -> Hugin_gg.Box2.t optionbounds p is Picture.bounds p, or everywhere if the bounds lie beyond the range of floats, so that a picture that far is taken to show everywhere.
val uncut : Hugin_vg.Picture.t -> Hugin_vg.Picture.tuncut p is p without its clips and tags. Unlike the bounds of p, which a clip cuts at the scale and pens p has, its bounds, scaled by an instance's scale and grown by the reach of the pens the instance keeps, hold what that instance paints: a stroke that misses a clip at scale 1. may meet it at another, with the pen an instance keeps.
val meets : Hugin_gg.Box2.t -> Hugin_gg.Box2.t -> Hugin_gg.Box2.t optionmeets a b is the box of the points in both a and b, or None if they have none or only touch, to within rounding, each extending past the other along an axis: what a leaf whose box touches a clip's box paints is nothing, however rounding has placed the two. A box within the other meets it, however thin.
val exists : (Hugin_vg.Picture.t -> bool) -> Hugin_vg.Picture.t -> boolexists f p is true iff f holds of p or of a picture within it.
val fold_strokes :
(Hugin_gg.Affine.t -> Hugin_gg.Stroke.t -> 'a -> 'a) ->
Hugin_gg.Affine.t ->
Hugin_vg.Picture.t ->
'a ->
'afold_strokes f m p acc folds f over the strokes of p, in order, each with m composed with the transforms above it within p. It skips the strokes under a composition that Hugin_gg.Affine.invert gives no inverse, which paint nothing.
val reach : Hugin_gg.Affine.t -> float -> Hugin_vg.Picture.t -> floatreach m k p is how far the strokes of p under m reach beyond their paths, their lengths multiplied by k: the largest Hugin_gg.Stroke.reach of the pens of p, mapped through the transforms within p and through m. Stamps within p keep their pens, so their scales do not change it.
val shows :
Hugin_gg.Box2.t ->
reach:float ->
Hugin_gg.P2.t ->
float ->
Hugin_gg.Box2.t ->
boolshows cut ~reach at s b is true iff b scaled by s, moved to at and grown by reach meets cut: an instance at at of scale s of a picture of box b, whose pens reach reach, may paint within cut.
val positions :
Hugin_gg.Box2.t ->
reach:float ->
Hugin_gg.Box2.t ->
Hugin_gg.Box2.t optionpositions cut ~reach b is the box of the positions at which an instance of scale 1. shows, up to rounding: cut grown by reach and moved back by the corners of b; or None if that box is not finite.
val color :
Hugin_gg.Color.t array option ->
int ->
own:(Hugin_gg.Color.t -> 'a) ->
'a ->
'acolor cs i ~own inherited is what paints a leaf of instance i: its own colour own cs.(i), or inherited if cs is None.