Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!newstop!sun!johnston From: johnston@adhawk.Eng.Sun.COM (Scott Johnston) Newsgroups: comp.sys.mac.programmer Subject: Re: Query: question about color on the mac... Message-ID: <139442@sun.Eng.Sun.COM> Date: 24 Jul 90 15:30:18 GMT References: <10754@odin.corp.sgi.com> <23410@megaron.cs.arizona.edu> Sender: news@sun.Eng.Sun.COM Organization: Sun Microsystems, Mt. View, Ca. Lines: 53 In article <23410@megaron.cs.arizona.edu> gerhard@cs.arizona.edu (Gerhard Mehldau) writes: >In article <10754@odin.corp.sgi.com>, myoung@joker.sgi.com (Mark Young) writes: >> >> I'm working on a class project that does simple color halftoning, and I >> want to be able to set up the color table and then write color index values >> to the pixels on the screen. >> >> [stuff deleted...} >> >> ...myoung > >I have struggled through this, too - IM V and the >32-Bit QuickDraw documentation really isn't very >clear on this topic (Apple, are you listening?). > > [stuff deleted...] > >The code for the color table/palette stuff should >look like this (note that this code requires 32-Bit >QuickDraw to be installed): > >CTabHandle gTable; >PaletteHandle gPalette; >gTable = GetCTable(kColorTable); /* read in from resource file */ >gPalette = NewPalette((*gTable)->ctSize+1,gTable,pmTolerant+pmExplicit,0); >SetPalette((WindowPtr)(-1),gPalette,TRUE); /* make default palette */ > >Good luck! > >- Gerhard I have been flailing miserably with this, too, so correct me if I am wrong. Isn't the color table created with the above set of commands still dependent upon the underlying device CLUT? And this device CLUT has not changed? So, the way I understand it, the Color Manager will attempt to find the closest RGB matches between this newly created CLUT and the device CLUT. What if you wanted to do 256-tone Gray Scale? Wouldn't you need to go in and modify the device's CLUT directly in order to get this wide range of grays? Just worth mentioning: modifying the device CLUT gets ugly. All the cached fonts, etc become invalidated, and I have had a difficult time trying to bring to machine back to the state it was in before I messed with the CLUT. Maybe there's a lesson here...:^) Thanks in advance for any advice and/or help. sj johnston@portia.stanford.edu johnston@adhawk.sun.com ----------------------------