ADC Home > Reference Library > Technical Notes > Legacy Documents > Graphics & Imaging >
Legacy Document
Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.
Current information on this Reference Library topic can be found here:
|
Using Color CursorsTo avoid system errors or crashes while using a color cursor, incorporate the following information in your application development. Setting Bounds for your CursorIf your cursor is, for example, 15 pixels tall and 9 pixels wide, you might be
tempted to use these values for the bounds.bottom and bounds.right,
respectively, in your cursor's pixel map. Don't. When the cursor's image
needs to be expanded (that is, when you specify a two bit-per-pixel cursor and
the mouse pointer is on an eight-bit screen) the To avoid this problem, always specify the Inopportune Purging of a `
|
{
GetGWorld (&savePort, &saveDevice);
SetGWorld (offPort, NULL);
...copybits and other stuff goes here
SetGWorld (savePort, saveDevice);
}
|
A documented side effect of SetGWorld is that the device parameter will be ignored when you pass in a GWorld port. So, if the current port is a GWorld port, the save-restore code in SetCCursor will always make the current device that of the GWorld.
One place where this is especially dangerous is when the current port is a disposed
GWorld. DisposeGWorld sets the current GDevice to a
safe device, but doesn't affect
the current port. If you then call SetCCursor before a valid port
has been set, then
SetCCursor will cause the current GDevice to point at
the disposed GDevice, and the
system will crash shortly afterwards.
The easiest way to avoid this side-effect of SetCCursor is to:
- Ensure that your port and device always match. Never allow a situation where the port and device can be mismatched. This helps cure many problems unrelated to color cursors.
- Never dispose of the current port without setting a valid QuickDraw port first. Drawing to a disposed port or device will most likely result in a crash.
Don't Call SetCCursor at Interrupt Time
SetCCursor is documented as moving memory. In 7.5.2 and
later, SetCCursor makes calls
to CopyBits and other QuickDraw routines. Never, ever call
SetCCursor at interrupt time!
Calling SetCursor at interrupt time is still allowed, however.
References
Inside Macintosh: Imaging with QuickDraw
Change History
|
01-June-1989 |
Originally written. |
|
01-February-1996 |
The warning about purgeable 'clut' resources added. |
|
23-December-1997 |
Warnings about |
Downloadables
|
|
Acrobat version of this Note (48K). |