Important: The information in this document is obsolete and should not be used for new development.
Color Tables
The complete set of colors available at a given time for an indexed-pixel device is contained in aColorTable
data structure. (TheColorTable
data structure is described in the chapter "Color QuickDraw" in Inside Macintosh: Imaging With QuickDraw.)
struct ColorTable { long ctSeed; /* unique identifier for table */ short ctFlags; /* high bit is set for a */ /* GDevice, clear for a PixMap */ short ctSize; /* number of entries in table minus 1 */ CSpecArrayctTable;/* array[0..0] of ColorSpec records */ }; typedef struct ColorTable ColorTable;ThectSeed
field contains a version identifier for the color table. Its value is a unique number higher thanminSeed
, a predefined constant with a value of 1023. (If a color table is created from a resource, its resource number becomes the initialctSeed
.) Values of 1023 and below are reserved for standard color tables defined by Color QuickDraw. Color tables that are part of aGDevice
data structure always have the high bit of thectFlags
field set. (Color tables that are part of pixel maps not associated with aGDevice
data structure have this bit clear.)The
ctTable
field contains an array ofColorSpec
entries. The typeColorSpec
consists of an integer value and a color, as shown in the following specification.
struct ColorSpec { short value; /* color representation */ RGBColor rgb; /* color value */ }; typedef struct ColorSpec ColorSpec;In color tables for screen devices, the Color Manager and Palette Manager use thevalue
field to contain color matching and protection information; in such tables, the index for a particular color is determined by its position in the table, not by the contents of thevalue
field.