brownrigg@kuhub.cc.ukans.edu (06/07/90)
Can anyone suggest the general mechanism one needs to use to display a pixMap with PRECISELY CHOSEN colors?? I've read and re-read the relevent chapters of IMV5 and am still confused and frustrated as to what to do. The problem domain is that I have output from a 24->8bit color quantizer which has carefully chosen 256 optimal colors representing the source image. I simply want to display the image on the Mac, and since this is a research context, I want all 256 colors of my AppleExtendedColorVideo card available, regardless of what color effects happen (temporarily) to the desktop, menu bar, window frames, etc. No multiple screens. I seems as though I don't want/need the services of the Palette manager getting in the way, but I'm not sure. All I ever get is the default palette, or a black&white one. Thanks in advance for any non-flame replies.. Rick Brownrigg Kansas Geological Survey
russotto@eng.umd.edu (Matthew T. Russotto) (06/07/90)
In article <24664.266d7b29@kuhub.cc.ukans.edu> brownrigg@kuhub.cc.ukans.edu writes: >Can anyone suggest the general mechanism one needs to use to display a >pixMap with PRECISELY CHOSEN colors?? I've read and re-read the relevent >chapters of IMV5 and am still confused and frustrated as to what to do. Yep. In fact, I can suggest TWO ways. One is to put a 'pltt' resource id 0 in your application resource file. The resource should contain valid pltt data with only two colors: black, and white. Then just use SetEntries from the color manager chapter to put YOUR colors in. Of course, be careful to SaveEntries and RestoreEntries at suspend and resume time under multifinder, so other applications don't get their colors messed up, and you don't have yours messed up. You also have to be very careful in a multi-screen environment using this method. The second, and far superior method (IMO) is to use NewPalette to create a palette with the 254 colors you need, plus black and white in the first two entries (yes, I know some quantizers don't always put out a black and white. Tough.). Black and white should be marked as pmCourteous, all the other colors should be pmTolerant with a tolerance of 0 (pmIntolerant?). Then SetPalette(yourwindow, yourpalette, TRUE); ActivatePalette(yourwindow); to make the window automatically keep your color environment; (the reason black and white should be set to pmCourteous is that the Palette manager used to reserve an additional index for them, in addition to the standard positions at the beginning and end of the color table. I don't know if this is still the case or if it is correct behavior, but setting them to courteous won't hurt) -- Matthew T. Russotto russotto@eng.umd.edu russotto@wam.umd.edu ][, ][+, ///, ///+, //e, //c, IIGS, //c+ --- Any questions?