[comp.sys.mac.programmer] Palette Mgr questions

mkb@rover.ri.cmu.edu (Mike Blackwell) (05/19/88)

I'm writing an application that needs a lot of gray scale values for
rendering. Right now I'm using 120, and will probably use more later. I'm
trying to make the application work with various screen depths, so I've
ordered the palette as recommended: 0 = white, 1 = black, 2 = 33% gray, 3 =
66% gray, 4-15 = finer gradiations of gray, 16 - 119 = even finer
gradiations. All of these are tolerant colors, with zero tolerance. Now I
draw a band that varies continuously from black to white in 120 steps, using
the appropriate palette entries. If the screen depth is set to 8-bits, it
works fine. If I set it to 4-bits, it also works fine - I get 16 gray levels
in even steps. However if I set the screen depth to 2-bits, I get the
following: first quater of band is black, next is dark gray, next is
light gray, and the last is black again, except for the last stripe, which
is white. I would expect the last quarter to be all white. If I set 1-bit
depth, the whole band is black, except the last stripe, which is white.
Again, what I would like is half black, then half white. I understand why
1-bit mode doesn't work (I think): anything non-white is drawn black. But
why doesn't 2-bit mode do what I expect?

My other question has to do with the palette used for the screen background.
Who manages it? If my application sucks up a lot of tolerant colors, then
the background colors change, being the lowest on the CLUT priority list, I
suppose. But when my applications exits, the background never seems to get
its original CLUT entries back. How come? Another strange background issue:
I have two screens, one color and one gray scale. If I take a window with a
full palette and drag it from the gray screen to the color, the color
background changes colors. Now I drag the window back to the gray screen.
The color background remains the same, except where the window was - there
the colors are different again (not even the originals). Looks strange.
Causing an AutoIdle blank and update will fix the off-colored hole in the
background, but doesn't restore the original colors... Strange. Any ideas?

		Mike Blackwell		mkb@rover.ri.cmu.edu