![]() |
Cursor |
Header: Quickdraw.h |
struct Cursor { Bits16 data; Bits16 mask; Point hotSpot; }; typedef Cursor CursPtr;
Cursor image data, which must begin on a word boundary.
The cursors mask. QuickDraw uses the mask to crop the cursors outline into a background color or pattern. QuickDraw then draws the cursor into this shape.
A point in the image that aligns a point (not a bit) in the image with the mouse location on the screen. Whenever the user moves the mouse, the low-level interrupt-driven mouse functions move the cursor. When the user clicks, the Event Manager function WaitNextEvent reports the location of the cursors hot spot in global coordinates.
Your application typically does not create Cursor structures. Although you can create a Cursor structure and its associated Bits16 array in your program code, it is usually easier to create a black-and-white cursor in a cursor resource,‘CURS.
A cursor is a 256-pixel, black-and-white image in a 16-by-16 pixel square. When your application uses the GetCursor function to get a cursor from a 'CURS' resource, GetCursor loads the resource into memory as a Cursor structure. Your application then displays the color cursor by using the SetCursor function.
The cursor appears on the screen as a 16-by-16 pixel square. The appearance of each bit if the square is determined by the corresponding bits in the data and the mask and, if the mask bit is 0, by the pixel under the cursor. The four possible combinations of values for the data bit and the mask bit are:
The resulting pixel on the screen is white.
The resulting pixel on the screen is black.
The resulting pixel on the screen is the same as the pixel under the cursor.
The resulting pixel on the screen is the inverse of the pixel under the cursor.
Notice that if all mask bits are 0, the cursor is completely transparent, in that the image under the cursor can still be viewed. Pixels under the white part of the cursor appear unchanged; under the black part of the cursor, black pixels show through as white.
Basic QuickDraw supplies a predefined cursor in the global variable named arrow; this is the standard arrow cursor.
© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)