[Alephmodular-devel] Macintosh oddity: GetCTable(8)?
Status: Pre-Alpha
Brought to you by:
brefin
From: Br'fin <br...@ma...> - 2003-03-30 21:31:57
|
I was poking through AlephModular while trying to rehandle how cluts were used. And I stumbled upon the usage of GetCTable(8). Which, upon checking PB's docs for GetCTable seemed wrong. And so I checked in AlephOne and found the same issue (It dates back to the Marathon2 code originally) Both things call GetCTable with an argument of 8 ... it seems like the correct argument should be 72. I don't know of any tech notes that would say that 8 should also work for a 256 color system clut. Can anyone confirm or deny that this is some kind of 256 color problem? -Jeremy Parsons From AlephOne: FileHandler.h void GetSystemColorTable() {Unload(); RsrcHandle = Handle(GetCTable(8));} From PB's reference docs: GetCTable Obtains a color table stored in a 'clut' resource. CTabHandle GetCTable ( SInt16 ctID ); Parameter descriptions ctID The resource ID of a 'clut' resource. function result A handle to the color table. If the 'clut' resource with that ID is not found, GetCTable returns NULL.Before you place this handle in the pmTable field of a PixMap structure, first use the DisposeCTable function to dispose of the handle already there. Discussion Before you modify a ColorTable structure, change its ctSeed field to invalidate it. To do this, use the CTabChanged function. The GetCTable function recognizes a number of standard 'clut' resource IDs. You can obtain the default grayscale color table for a given pixel depth by calling GetCTable , adding 32 (decimal) to the pixel depth, and passing these values in the ctID parameter: * A pixel depth of 1 Pass a resource ID of 33. Color table composition: black, white. * A pixel depth of 2 Pass a resource ID of 34. Color table composition: black, 33% gray, 66% gray, white. * A pixel depth of 3 Pass a resource ID of 35. Color table composition: black, 14 shades of gray, white. * A pixel depth of 4 Pass a resource ID of 36. Color table composition: black, 254 shades of gray, white. For full color, obtain the default color tables by adding 64 to the pixel depth and passing these values in the ctID parameter: * A pixel depth of 2 Pass a resource ID of 66. Color table composition: black, 50% gray, highlight color, white. * A pixel depth of 4 Pass a resource ID of 68. Color table composition: black, 14 colors including the highlight color, white. * A pixel depth of 8 Pass a resource ID of 72. Color table composition: black, 254 colors including the highlight color, white. Availability Supported in Carbon. Available in CarbonLib 1.0 and later when running Mac OS 8.1 or later. Available in Mac OS X 10.0 and later. Special Considerations The GetCTable function may move or purge memory blocks in the application heap; do not call this function at interrupt time. |