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 Reference /
Chapter 1 - Palette Manager Reference /
Palette Manager Functions / Initializing and Allocating Palettes


NewPalette

Allocates a new palette from colors in the color table.

pascal PaletteHandle NewPalette (
     short entries,
                                CTabHandle srcColors,
                                short srcUsage,
                                short srcTolerance); 
entries
The number of ColorInfo structures to be created in the new palette.
srcColors
The color table from which the colors are to be obtained.
srcUsage
The usage value to be assigned each ColorInfo structure in the palette.
srcTolerance
The tolerance value to be assigned each ColorInfo structure in the palette.
DISCUSSION
The NewPalette function fills the palette with as many RGB values from the color table as it has or can fit. NewPalette sets the usage field of each color to the value in the srcUsage parameter and the tolerance value of each color to the value in the srcTolerance parameter. If no color table is provided (srcColors = nil), then all colors in the palette are set to black (red, green, and blue equal to $0000).

SEE ALSO
For an example of using the NewPalette function to create a palette, see Listing 1-1 (page 1-22) in Advanced Color Imaging on the Mac OS.

To attach a palette to a window after creating it, use the SetPalette function (page 1-11).

To change the entries in a palette after creating it, use the SetEntryColor function (page 1-28) and the SetEntryUsage function (page 1-29).


Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 NOV 1996