4.2 Struct Type and Accessors
A guard ensures that the values field has length (* components width height), and that each size field is a nonnegative fixnum.
Examples: | |||||||||
|
The default flomap constructor is perhaps the hardest to use. Instead, to construct a flomap from scratch, you should generally use make-flomap, make-flomap*, build-flomap or draw-flomap.
procedure
(flomap-size fm) →
Nonnegative-Fixnum Nonnegative-Fixnum fm : flomap
If x or y is out of bounds, this function returns 0.0. If k is out of bounds, it raises an error. The Conceptual Model section explains why k is treated differently.
procedure
(flomap-ref* fm x y) → FlVector
fm : flomap x : Integer y : Integer
If x or y is out of bounds, this function returns an flvector filled with 0.0. It always returns an flvector of length (flomap-components fm).
Like all other flomap functions that operate on real-valued coordinates, flomap-bilinear-ref regards known values as being at half-integer coordinates. Mathematically, if x = (+ i 0.5) and y = (+ j 0.5) for any integers i and j, then (flomap-bilinear-ref fm k x y) = (flomap-ref fm k i j).
Suppose fm is size w×h. If x ≤ -0.5 or x ≥ (+ w 0.5), this function returns 0.0; similarly for y and h. If k is out of bounds, it raises an error. The Conceptual Model section explains why k is treated differently.
procedure
(flomap-bilinear-ref* fm x y) → FlVector
fm : flomap x : Real y : Real
procedure
(flomap-min-value fm) → Float
fm : flomap
procedure
(flomap-max-value fm) → Float
fm : flomap
procedure
(flomap-extreme-values fm) →
Float Float fm : flomap
procedure
(flomap-nonzero-rect fm) →
Nonnegative-Fixnum Nonnegative-Fixnum Nonnegative-Fixnum Nonnegative-Fixnum fm : flomap
The values returned by flomap-nonzero-rect can be sent to subflomap to trim away zero values. But see flomap-trim, which is faster for alpha-multiplied flomaps.
procedure
(coords->index c w k x y) → Fixnum
c : Integer w : Integer k : Integer x : Integer y : Integer
procedure
(unsafe-flomap-ref vs c w h k x y) → Float
vs : FlVector c : Integer w : Integer h : Integer k : Integer x : Integer y : Integer
This function is used by some library functions, such as flomap-bilinear-ref, to index into already-destructured flomaps. From untyped code, applying this function is likely no faster than applying flomap-ref, because of extra contract checks.