On this page:
flomap-pin
flomap-pin*
flomap-lt-superimpose
flomap-lc-superimpose
flomap-lb-superimpose
flomap-ct-superimpose
flomap-cc-superimpose
flomap-cb-superimpose
flomap-rt-superimpose
flomap-rc-superimpose
flomap-rb-superimpose
flomap-vl-append
flomap-vc-append
flomap-vr-append
flomap-ht-append
flomap-hc-append
flomap-hb-append

4.9 Compositing🔗ℹ

Unless stated otherwise, compositing functions assume every flomap argument has an alpha component.

procedure

(flomap-pin fm1 x1 y1 fm2)  flomap

  fm1 : flomap
  x1 : Integer
  y1 : Integer
  fm2 : flomap
(flomap-pin fm1 x1 y1 fm2 x2 y2)  flomap
  fm1 : flomap
  x1 : Integer
  y1 : Integer
  fm2 : flomap
  x2 : Integer
  y2 : Integer
Superimposes fm2 over fm1 so that point x2 y2 on flomap f2 is directly over point x1 y1 on flomap f1. If x2 and y2 are not provided, they are assumed to be 0. The result is expanded as necessary.

fm1 and fm2 must have the same number of components.

Examples:
> (flomap-pin fm -10 -10 sine-fm)

flomap-pin: expected two flomaps with the same number of

components; given one with 4 and one with 1

> (define circle-fm
    (draw-flomap (λ (fm-dc)
                   (send fm-dc set-pen "black" 4 'short-dash)
                   (send fm-dc set-brush "yellow" 'solid)
                   (send fm-dc set-alpha 1/2)
                   (send fm-dc draw-ellipse 2 2 124 124))
                 128 128))
> (flomap->bitmap (flomap-pin fm 0 0 circle-fm 64 64))

image

> (flomap->bitmap (flomap-pin sine-fm 50 0 sine-fm))

image

The other compositing functions are defined in terms of flomap-pin.

procedure

(flomap-pin* x1-frac    
  y1-frac    
  x2-frac    
  y2-frac    
  fm0    
  fm ...)  flomap
  x1-frac : Real
  y1-frac : Real
  x2-frac : Real
  y2-frac : Real
  fm0 : flomap
  fm : flomap
For each adjacent pair fm1 fm2 in the argument list, pins fm2 over fm1.

The pin-over points are calculated from the four real arguments as follows. If fm1 is size w1×h1, then x1 = (* w1 x1-frac) and y1 = (* h1 y1-frac), and similarly for x2 and y2.

The following example pins the upper-left corner of each fm2 over a point near the upper-left corner of each fm1:
> (flomap->bitmap (flomap-pin* 1/8 1/8 0 0
                               circle-fm circle-fm circle-fm))

image

All the flomap superimpose and append functions are defined using flomap-pin* with different pin-over point fractions. For example, (flomap-lt-superimpose fm0 fm ...) = (flomap-pin* 0 0 0 0 fm0 fm ...), and (flomap-vc-append fm0 fm ...) = (flomap-pin* 1/2 1 1/2 0 fm0 fm ...).

procedure

(flomap-lt-superimpose fm0 fm ...)  flomap

  fm0 : flomap
  fm : flomap

procedure

(flomap-lc-superimpose fm0 fm ...)  flomap

  fm0 : flomap
  fm : flomap

procedure

(flomap-lb-superimpose fm0 fm ...)  flomap

  fm0 : flomap
  fm : flomap

procedure

(flomap-ct-superimpose fm0 fm ...)  flomap

  fm0 : flomap
  fm : flomap

procedure

(flomap-cc-superimpose fm0 fm ...)  flomap

  fm0 : flomap
  fm : flomap

procedure

(flomap-cb-superimpose fm0 fm ...)  flomap

  fm0 : flomap
  fm : flomap

procedure

(flomap-rt-superimpose fm0 fm ...)  flomap

  fm0 : flomap
  fm : flomap

procedure

(flomap-rc-superimpose fm0 fm ...)  flomap

  fm0 : flomap
  fm : flomap

procedure

(flomap-rb-superimpose fm0 fm ...)  flomap

  fm0 : flomap
  fm : flomap
These create a new flomap by superimposing the flomaps in the argument list. The two-letter abbreviation determines the pin-over points. For example, flomap-lt-superimpose (“flomap left-top superimpose”) pins points 0 0 together on each adjacent pair of flomaps:
See flomap-pin and flomap-pin* for implementation details.

procedure

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

  fm0 : flomap
  fm : flomap

procedure

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

  fm0 : flomap
  fm : flomap

procedure

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

  fm0 : flomap
  fm : flomap

procedure

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

  fm0 : flomap
  fm : flomap

procedure

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

  fm0 : flomap
  fm : flomap

procedure

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

  fm0 : flomap
  fm : flomap
These create a new flomap by spatially appending the flomaps in the argument list. The two-letter abbreviation determines direction (v or h) and alignment (l, c, r, or t, c, b).

Example:
> (flomap->bitmap (flomap-ht-append circle-fm fm
                                    (flomap-scale circle-fm 1/2)))

image

See flomap-pin and flomap-pin* for implementation details.