Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!asuvax!ncar!ncar.ucar.edu!hpoppe From: hpoppe@ncar.ucar.edu (Herb Poppe) Newsgroups: comp.sys.mac.programmer Subject: Re: Color offscreen pixmap woes... Message-ID: <10972@ncar.ucar.edu> Date: 9 Apr 91 15:53:35 GMT References: Sender: news@ncar.ucar.edu Distribution: na Organization: National Center for Atmospheric Research Lines: 52 In article smargari@nmsu.edu (Susan Margarit [or is it Jim - or a "Man Called Sue"]) writes: > Question #2. Why is it that when you draw a 256 color pict > resource into a color window, the DrawPicture routine ignores > the color palette in the pict and uses the default palette? There is no color palette in a PICT. > When you paste it into the scrapbook, the scrapbook uses the correct palette. Sorry, it doesn't. The Scrapbook is a DA. I would be surprised if it used the Palette Manager at all. I suspect that (with SingleFinder) the palette that is used is whatever is being used (or not used) by the program it is executing in. In MultiFinder, it runs inside DA Handler. I would be surprised if DA Handler uses the Palette Manager; after all, the Finder doesn't (in System 6.0.x and earlier). > How do you get DrawPicture to use the correct palette? You have to set up the correct palette yourself before you call DrawPicture. You could paste the palette into the Clipboard along with the PICT if you wrote the "pasting" program. But that is probably a no-no. Quoting from Inside Mac Vol. 1-454: "From the user's point of view there can only be one thing in the Clipboard at a time, but the application may store more than one version of the information in the scrap, each representing the same Clipboard contents in a different form." A 'PICT' and a 'pltt' are not different forms of the same "thing". You could ignore this quote; but, if you didn't write the "pasting" program, chances are "they" didn't include a "pltt" anyway. So you are left with reading through all the PICT opcodes, extracting all the color references and building the "correct" palette. Good luck, and when you've accomplished that please post your efforts to the net. Instant fame and fortune will be yours (well, fame, at least). Apple, however, will not be pleased. Quoting from Inside Mac Vol. 5-96: "The opcode information in Table 3 is provided for the purpose of debugging application-generated PICT files. Your application should generate and read PICT files only by using standard QuickDraw or Color QuickDraw routines (OpenPicture, ClosePicture)." None of these routines, however, do what needs to be done. In short, there doesn't appear to be a legal way to do this, which might explain while one can never successfully copy/paste a color PICT between any two given programs and get the colors one expects. By the way, I would love to be proven wrong. Herb Poppe hpoppe@ncar.ucar.edu NCAR (303) 497-1296 1850 Table Mesa Dr. Boulder, CO 80307-3000