>> I want to create a GWorld that will use a color table.
Is it possible to use a 'Pltt' or 'clut' resource ?
I want to use a 216 colors 'web' palette to do color reduction on my PICT's.
I'm using the Gif image filter from Staz to save the image.
I understand the NEWGWORLD function, but not gwCTabh& and gdH&.
Err% = FN NEWGWORLD (gwPtr&,gwPixDepth%,gwRect,gwCTabH&,gdH&,gwFlags&)<<
Quick rundown: if your gWorld's pixdepth is set to 0, it will use the bitdepth
of your current output device, _and_ any palette associated with that device.
If you set the pixdepth explicitly to something _other than_ the monitor's
bitdepth, it will default to the system palette. (In your situation, using
only web-standard colors, you won't see any difference, but let's play it safe
to make sure you don't use any of those other 40 colors.)
Do you already have the color table? ResEdit lets you import pltt and clut
into each other, but you have to do the final tweaking to put black & white in
the right places (and, if necessary, fill the unused slots in a clut). The
resource icons for clut and pltt in ResEdit are lovely, because they show you
exactly how each resource type needs to be laid out.
mycolors& = FN GETCTABLE(resnumber) 'res number of clut
err = FN NEWGWORLD(newport&,8,myrect,mycolors&,0,0)
'8 is for forced 8-bit gWorld regardless of current monitor setting
That's all.
If you're using mac-standard colors you don't need a pltt; otherwise make a
pltt containing the same colors as your clut (they don't have to be in the
same order, as long as black & white are in the right places), and number it
0. It will be used by all windows, but not by offscreen gWorlds.