Pixmap cursors are created by specifying two pixmaps: a shape pixmap and a mask pixmap. The pixmaps must both have a depth of 1 (that is, 1 bit per pixel). The mask pixmap specifies at which pixels the cursor is opaque. Where the mask pixmap is 0, the background shows through. Where it is 1, the shape pixmap specifies the color of the pixel. Where the shape pixmap is 1, the foreground color (black) is used. Where it is 0, the background color (white) is used. A mask pixmap of nil specifies that the cursor is opaque at all pixels. For more information on creating and using pixmaps, see "Using pixmaps".In the following example, a CgPixmap is created by sending the createBitmapFromData:width:height: message to the drawable. Then this CgPixmap object is sent the createPixmapCursor:x:y: or createPixmapCursor:foregroundColor:backgroundColor:x:y: message. Parameters passed to this method include an optional mask pixmap, and the x- and y-coordinates of the cursor's hot spot. The hot spot is the point at which the cursor is centered over the current pointer coordinates.
|