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: Advanced Color Imaging on the Mac OS /
Chapter 7 - Color Manager / About the Color Manager


Color Tables

The complete set of colors available at a given time for an indexed-pixel device is contained in a ColorTable data structure. (The ColorTable 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;
The ctSeed field contains a version identifier for the color table. Its value is a unique number higher than minSeed, a predefined constant with a value of 1023. (If a color table is created from a resource, its resource number becomes the initial ctSeed.) Values of 1023 and below are reserved for standard color tables defined by Color QuickDraw. Color tables that are part of a GDevice data structure always have the high bit of the ctFlags field set. (Color tables that are part of pixel maps not associated with a GDevice data structure have this bit clear.)

The ctTable field contains an array of ColorSpec entries. The type ColorSpec 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 the value 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 the value field.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
13 NOV 1996