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 aColorTabledata structure. (TheColorTabledata 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;ThectSeedfield 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 aGDevicedata structure always have the high bit of thectFlagsfield set. (Color tables that are part of pixel maps not associated with aGDevicedata structure have this bit clear.)The
ctTablefield contains an array ofColorSpecentries. The typeColorSpecconsists 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 thevaluefield 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 thevaluefield.