Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Imaging With QuickDraw /
Chapter 4 - Color QuickDraw / Color QuickDraw Reference
Color QuickDraw Routines / Creating and Disposing of Color Tables


GetCTable

To get a color table stored in a 'clut' resource, use the GetCTable function.

FUNCTION GetCTable (ctID: Integer): CTabHandle;
ctID
The resource ID of a 'clut' resource.
DESCRIPTION
For the color table defined in the 'clut' resource that you specify in the ctID parameter, the GetCTable function returns a handle to a ColorTable record. If the 'clut' resource with that ID is not found, GetCTable returns NIL.

If you place this handle in the pmTable field of a PixMap record, you should first use the DisposeCTable procedure to dispose of the handle already there.

If you modify a ColorTable record, you should invalidate it by changing its ctSeed field. An easy way to do this is with the CTabChanged procedure, described on page 4-88.

The GetCTable function recognizes a number of standard 'clut' resource IDs. You can obtain the default grayscale color table for a given pixel depth by calling GetCTable, adding 32 (decimal) to the pixel depth, and passing this value in the ctID parameter, as shown in Table 4-5.

Table 4-5 The default color tables for grayscale graphics devices
Pixel depthResource IDColor table composition
133Black, white
234Black, 33% gray, 66% gray, white
436Black, 14 shades of gray, white
840Black, 254 shades of gray, white

For full color, you can obtain the default color tables by adding 64 to the pixel depth and passing this in the ctID parameter, as shown in Table 4-6. These default color tables are illustrated in Plate 1 at the front of this book.

Table 4-6 The default color tables for color graphics devices
Pixel depthResource IDColor table composition
266Black, 50% gray, highlight color, white
468Black, 14 colors including the highlight color, white
872Black, 254 colors including the highlight color, white

SPECIAL CONSIDERATIONS
The GetCTable function may move or purge memory blocks in the application heap. Your application should not call this function at interrupt time.

SEE ALSO
The 'clut' resource is described on page 4-94.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996