Programmer Reference : Common Graphics : Using pixmaps : Creating a bitmap from bitmap data
Creating a bitmap from bitmap data
A CgPixmap of depth 1, called a bitmap, can be created and initialized from bitmap data by sending the createBitmapFromData:with:height: message to a CgDrawable (window or pixmap). The message arguments are the bitmap data, its width, and its height. In the following example, an 8x8 bitmap is created using the data in bits. The bitmap forms a brick pattern when several copies are drawn side by side.
| bits bitmap |
bits := #
2r11111111
2r00000001
2r00000001
2r00000001
2r11111111
2r00010000
2r00010000
2r00010000].
bitmap := CgWindow default
createBitmapFromData: bits
width: 8
height: 8.
Last modified date: 01/29/2015