fry@huma1.HARVARD.EDU (David Fry) (07/20/87)
I'm writing a Mac II program and I'm having some problems with color tables. I basically read in PICT resources, DrawPicture them in an offscreen PixMap and then use that PixMap for all updating and scrolling, etc. It works very well except for some special instances. For instance, if I open a window with a picture when in 256 color mode, use the Control Panel to go to 2 colors, the first picture gets remapped. That's okay. Now I open an identical copy of the first picture it gets mapped differently (of course, the program doesn't understand that it's the same picture because I closed the resource file). That's okay too. But if I now use the Control Panel to switch back to 256 colors I crash. To help understand this I tried out the program given in Tech Note 120 to draw to an offscreen PixMap with suitable color table management. In this program we get the color table from theMaxDevice := GetMaxDevice(someRect) so we have the deepest possible PixMap. Then we have to clone this color table for our offscreen PixMap with the statements: ourCMHandle := theMaxDevice^^.gdPMap^^.pmTable; err := HandToHand(Handle(ourCMHandle)); { clone it } I wrote a strict C translation of this program, with no new features, in the new LSC 2.11 and it runs perfectly in color modes 4 and 256, but ALWAYS crashes on the HandToHand step when in color modes 2 and 16. Can anyone tell me what's wrong with ourCMHandle in these cases? I'd really appreciate any help. My main program basically works, but the fact that it fails in these oddball cases (like fiddling with the Control Panel while it's running) demonstrates that I don't really understand what's going on. Also, Apple people: how can I get a Mac II compatible Macsbug without buying MPW? Yes, I know TMON is better, but I can't afford the money or time to tackle it. David Fry fry@huma1.harvard.EDU Department of Mathematics fry@harvma1.bitnet Harvard University ...!harvard!huma1!fry Cambridge, MA 02138