bitmap-implant!

Synopsis

(bitmap-implant! bitmap-src bitmap-dest)

(bitmap-implant! bitmap-src bitmap-dest x-pos y-pos)

Parameters

  • bitmap-src
  • bitmap-dest
  • x-pos
  • y-pos

Description

This procedure inserts (implants) a bitmap into another, usually bigger bitmap. Only set pixels (1 for black) are inserted, thus any background pixels in the destination bitmap remain unchanged as they are.

The form with two parameters takes the destination coordinates from the orow and ocol values which need to be defined.

The other form specifies the destination coordinates explicitely.

Side Effects

The destination bitmap bitmap-dest is modified.

Return Value

The destination bitmap is returned.

Example

> (define dest-bm (bitmap-create 100 100))
dest-bm
> (define src-bm (bitmap-invert (bitmap-create 10 10)))
src-bm
> (bitmap-orow-set! src-bm 0)
0
> (bitmap-ocol-set! src-bm 0)
0
> (bitmap-implant! src-bm dest-bm)
#<bitmap orow:-1 ocol:-1 xres:-1 yres:-1 w:100 h:100>
> (bitmap-implant! src-bm dest-bm 20 10)
#<bitmap orow:-1 ocol:-1 xres:-1 yres:-1 w:100 h:100>
> (bitmap-writepng dest-bm "bitmap-implant.png")
ok
>

The resulting PNG file displays as follows:

bitmap-implant.png