Using the Palette Manager
To use the Palette Manager you generally do one of the following:
- Create a palette in any of several ways.
- Modify the colors and usages of the colors in a palette.
- Assign a palette to a window or assign a default palette to multiple windows.
After creating a palette and assigning it to a window, you can do the following:
- Draw with the palette's colors.
- Animate the colors in a palette.
- Draw or animate in an offscreen graphics world.
These tasks are explained in the rest of this chapter. This chapter also describes how and when to dispose of palettes and how to restore the default color table for an application. However, Palette Manager functions are dependent on the availability of Color QuickDraw. Therefore, before calling any of the functions described in the following sections, your application should check for the existence of Color QuickDraw by using the Gestalt function with the gestaltQuickDrawVersion selector. The Gestalt function returns a 4-byte value in its response parameter; the low-order word contains QuickDraw version data. In that low-order word, the high-order byte gives the major revision number and the low-order byte gives the minor revision number. Listed here are the various constants and the versions of QuickDraw that they represent.
/* quickdraw version */
gestaltOriginalQD = 0x000, /* original 1-bit QD */
gestalt8BitQD = 0x100, /* 8-bit color QD */
gestalt32BitQD = 0x200, /* 32-bit color QD */
gestalt32BitQD11 = 0x210, /* 32-bit color QDv1.1 */
gestalt32BitQD12 = 0x220, /* 32-bit color QDv1.2 */
gestalt32BitQD13 = 0x230, /* System 7: 32-bit color QDv1.3 */
Your application can also use the Gestalt function with the selector gestaltSystemVersion to check for the system software version under which your application is running. The functions SaveFore, RestoreFore, SaveBack, RestoreBack, ResizePalette, and RestoreDeviceClut require System Software version 6.0.5 or greater:
Subtopics
- Creating Palettes
-
- Designating a Default Palette for Your Application
-
- Drawing With a Palette's Colors
-
- Animating a Window With a Palette
-
- Disposing of a Palette and Restoring the Color Table
-
- Using Palettes With Offscreen Graphics Worlds
-