Important: The information in this document is obsolete and should not be used for new development.
Summary of the Palette Manager
Constants
enum { pmCourteous = 0, /* Courteous color.*/ pmTolerant = 0x0002, /* Tolerant color */ pmAnimated = 0x0004, /* Animated color */ pmExplicit = 0x0008, /* Explicit color */ pmWhite = 0x0010, /* Use on 1-bit devices */ pmBlack = 0x0020, /* Use on 1-bit devices */ pmInhibitG2 = 0x0100, pmInhibitC2 = 0x0200, pmInhibitG4 = 0x0400, pmInhibitC4 = 0x0800, pmInhibitG8 = 0x1000, pmInhibitC8 = 0x2000, /* NSetPalette Update Constants */ pmNoUpdates = 0x8000, /* no updates */ pmBkUpdates = 0xA000, /* background updates only */ pmFgUpdates = 0xC000, /* foreground updates only */ pmAllUpdates = 0xE000 /* all updates */ };Data Types
struct Palette { short pmEntries; /* entries in pmTable */ short pmDataFields[7];/* private fields */ ColorInfo pmInfo[1]; }; typedef struct Palette Palette; typedef Palette *PalettePtr, **PaletteHandle; struct ColorInfo { RGBColor ciRGB; /* true RGB values */ short ciUsage; /* color usage */ short ciTolerance; /* tolerance value */ short ciDataFields[3]; /* private fields */ }; typedef struct ColorInfo ColorInfo;Functions
Initializing the Palette Manager
pascal void InitPalettes(void); pascal short PMgrVersion(void);Initializing and Allocating Palettes
pascal PaletteHandle NewPalette(short entries, CTabHandle srcColors, short srcUsage, short srcTolerance); pascal PaletteHandle GetNewPalette (short PaletteID); pascal void DisposePalette(PaletteHandle srcPalette);Interacting With the Window Manager
pascal void ActivatePalette(WindowPtr srcWindow); pascal PaletteHandle GetPalette(WindowPtr srcWindow); pascal void SetPalette(WindowPtr dstWindow, PaletteHandle srcPalette, Boolean cUpdates); pascal void NSetPalette(WindowPtr dstWindow, PaletteHandle srcPalette, short nCUpdates); pascal void SetPaletteUpdates(PaletteHandle p, short updates); pascal short GetPaletteUpdates(PaletteHandle p);Drawing With Color Palettes
pascal void PmForeColor(short dstEntry); pascal void PmBackColor(short dstEntry); pascal void SaveFore(ColorSpec *c); pascal void RestoreFore(const ColorSpec *c); pascal void SaveBack(ColorSpec *c); pascal void RestoreBack(const ColorSpec *c);Animating Color Tables
pascal void AnimateEntry(WindowPtr dstWindow, short dstEntry, const RGBColor *srcRGB); pascal void AnimatePalette(WindowPtr dstWindow, CTabHandle srcCTab, short srcIndex, short dstEntry, short dstLength);Manipulating Palettes and Color Tables
pascal void CopyPalette(PaletteHandle srcPalette, PaletteHandle dstPalette, short srcEntry, short dstEntry, short dstLength); pascal void ResizePalette(PaletteHandle p, short size); pascal void RestoreDeviceClut(GDHandle gd); pascal void CTabToPalette(CTabHandle srcCTab, PaletteHandle dstPalette, short srcUsage, short srcTolerance); pascal void PaletteToCTab(PaletteHandle srcPalette, CTabHandle dstCTab);Manipulating Palette Entries
pascal void GetEntryColor(PaletteHandle srcPalette, short srcEntry, RGBColor *dstRGB); pascal void SetEntryColor(PaletteHandle dstPalette, short dstEntry, const RGBColor *srcRGB); pascal void GetEntryUsage(PaletteHandle srcPalette, short srcEntry, short *dstUsage, short *dstTolerance); pascal void SetEntryUsage(PaletteHandle dstPalette, short dstEntry,short srcUsage, short srcTolerance); pascal long Entry2Index (short entry);