[comp.sys.mac.programmer] Palette questions

tagreen@lothario.ucs.indiana.edu (Todd Green) (05/23/91)

Hello,

I've been writing an app that messes with palettes and have had no
trouble creating my own palette, but when I try to set the palette
back to the system default and redraw the screen it doesn't quite
work.  I get the correct colors, it just seems that the indices are
all messed up.  I've read IM I and V, but am clueless as to exactly
how the Pal. manager selects the indexes.  Basically I want to create
a custom palette, take over the screen, do my drawing, and then return
to the normal envirnment with the standard 256 color palette.
Everything works fine except for the order of the entries.  Here is
part of the code, THINK C 4.0 (yeah, I'm waiting for 5.0 to do the
big upgrade) and ResEdit 2.1 to generate the pltt's and clut's.

if( (myCTH = GetCTable( 128 )) == NIL_POINTER) SysBeep(1);
gSystemPalette = NewPalette( 256, myCTH, pmTolerant, PRECISE_TOLERANCE );
SetPalette( gSphereWindow, gSystemPalette, TRUE );

PaintBehind( gSphereWinRec, GrayRgn );
CalcVisBehind( gSphereWinRec, GrayRgn );

I've also tried getting the clut from rom (id=8).  It seems to work
fine, i.e. when I draw the entries of my palette to the screen (to
allow the user to select colors) it works exactly like the color
chooser in resedit, but after I use my custom palette, the index gets
messed up.

Help?!?  Thanks in advance.

Todd P.S. This totally unrelated but has been plaguing me also.
Exactly how does one support multiple monitors as far as dragging a
window goes? I've tried passing screenBits.bounds and RectRgn( GrayRgn
) (well a copy of GrayRgn) but neither seem to do the trick.  Thanks
again ;).

-- 
Internet: tagreen@bronze.ucs.indiana.edu
NeXTMail: tagreen@lothario.ucs.indiana.edu
BitNet:   tagreen@iubacs.bitnet