[comp.sys.mac.programmer] How do you write "friendly" color applications?

bytebug@dhw68k.cts.com (Roger L. Long) (07/31/88)

Maybe it's me not yet quite being in sync with the "Mac" way of doing things.
But to me it looks like doing much of anything substantial with color can be
very unfriendly to other color applications.  And it also looks like doing
what I want will mean direct twiddling with the Color Manager instead of the
more friendly Palette Manager.  Or worse...

Perhaps a few of you can point out which lines I failed to read between
in IM-V...

Problem:  My application opens some color windows, sets up some palettes,
	  does it's thing, disposes of the palettes, closes the windows,
	  and goes away.  I would have thought that the Palette Manager
	  would restore the CLUT entries it used when I dispose of my
	  palettes.  Nope.  So if you set up a palette with a lot of
	  bizarre colors, they'll remain in the CLUT, changing what your
	  screen looks like until the next time you reboot.  If you run
	  your application multiple times, you will likely use different
	  CLUT entries, which will screw up other colors, etc., etc.

Problem:  What's a good way to animate colors other than using pmAnimate?
	  Like if I have a pixmap with this nice picture in it that would
	  be nice to just CopyBits to the screen multiple times, changing
	  some colors in between, to get this nice dimout effect.  What
	  it looks like I would have to do would be:
		a) create a new color table attached to the pixmap between
		   each iteration
		b) map these new colors into the CLUT
		c) CopyBits
	  This seems like a lot of overhead for what I'd like to be a nice,
	  smooth, fast, dimout.

Problem:  Is there any way to tell if anyone is currently using a given
	  CLUT entry?  I would guess that ProtectEntry and ReserveEntry
	  are meant for this purpose.  Is that what the PaletteManager
	  uses in order to assign entries for animating colors?  If I
	  use ReserveEntry, does it have the same side-effect as using
	  pmAnimate in that the entry won't be matched by CopyBits calls?

Problem:  It would seem that the quick-and-dirty solution that might work
	  would be to just bypass CopyBits, and just set up some entries
	  in the CLUT, move some pixels into the CGrafPort pixmap via
	  BlockMove, and then animate by just setting new values in the 
	  CLUT.  This doesn't seem very friendly at all!

Thus, any and all bits of information about the ins and outs of Color would
be most appreciated.  The end result needs to be nice, smooth, animation,
complete with moving various things around on the screen, with changing
colors, all in the most friendly of ways.

Thanks much in advance.
-- 
	Roger L. Long
	dhw68k!bytebug