On this page:
flomap-ref-component
flomap-take-components
flomap-drop-components
flomap-append-components

4.4 Component Operations

procedure

(flomap-ref-component fm k)  flomap

  fm : flomap
  k : Integer
Extracts one component of a flomap and returns it as a new flomap. Raises an error if k is out of bounds.

Use this, for example, to extract the A and R components from an ARGB flomap:

procedure

(flomap-take-components fm k)  flomap

  fm : flomap
  k : Integer
Extracts the first k components and returns them as a new flomap. Raises an error if k is out of bounds.

procedure

(flomap-drop-components fm k)  flomap

  fm : flomap
  k : Integer
Extracts all but the first k components and returns them as a new flomap. Raises an error if k is out of bounds.

Use this, for example, to operate on only the RGB channels of an ARGB flomap:
> (flomap->bitmap
   (flomap-append-components (flomap-take-components fm 1)
                             (fm* 0.25 (flomap-drop-components fm 1))))

image

procedure

(flomap-append-components fm0 fm ...)  flomap

  fm0 : flomap
  fm : flomap
Appends the components of the given flomaps pointwise. Raises an error if not all flomaps are the same width and height.

Examples:
> (equal? fm (flomap-append-components (flomap-take-components fm 2)
                                       (flomap-drop-components fm 2)))

#t

> (flomap-append-components (make-flomap 1 10 10)
                            (make-flomap 3 20 20))

flomap-append-components: expected same-size flomaps; given

sizes 10×10 and 20×20

This function could behave according to the Conceptual Modelthat is, expand the smaller ones to the largest size before appending. However, appending the components of two different-size flomaps almost always indicates a logic or design error. If it really is intended, use flomap-inset or subflomap to expand the smaller flomaps manually, with more control over the expansion.