► |  | Images

1 | Icons
2 | Logos
3 | Embedding Bitmaps in Compiled Files
4 | Floating-Point Bitmaps

▼ | 4 | Floating-Point Bitmaps

4.1 | Overview
4.2 | Struct Type and Accessors
4.3 | Conversion and Construction
4.4 | Component Operations
4.5 | Pointwise Operations
4.6 | Gradients and Normals
4.7 | Blur
4.8 | Resizing
4.9 | Compositing
4.10 | Spatial Transformations
4.11 | Effects

On this page:

flomap-ref-component
flomap-take-components
flomap-drop-components
flomap-append-components

top ← prev up next →

#### 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:

> > (flomap->bitmap (flomap-ref-component fm 0))
> > (flomap->bitmap (flomap-ref-component fm 1))

> 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.

Example:
> > (flomap->bitmap (flomap-take-components fm 2))

> 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))))

> 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 Model—that 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.

top ← prev up next →