Programmer Reference : Common Graphics : Using pixmaps : Creating a pixmap using createPixmapFromBitmapData:
Creating a pixmap using createPixmapFromBitmapData:
In this example, a series of bits are passed to the pixmap creation routine along with width, height, foreground pixel, background pixel, and depth information. Wherever a 1 appears in the bitmap data, the foreground pixel is set in the pixmap. Wherever a 0 appears, the background pixel is set. After creating the pixmap, the example copies it onto the screen.
| gc window bits pixmap |
gc := CgGC default.
window := CgWindow default.
bits := #
2r11111111 2r11111111
2r00000110 2r01100000
2r00011000 2r00011000
2r01100000 2r00000110
2r10000000 2r00000001].
pixmap := window
createPixmapFromBitmapData: bits
width: 16
height: 5
fg: window blackPixel
bg: window whitePixel
depth: window depth.
pixmap
copyArea: window
gc: gc
srcX: 0
srcY: 0
width: 16
height: 5
destX: 10
destY: 10.
pixmap freePixmap
Last modified date: 01/29/2015