cfry@jove.cs.pdx.edu (Chall Fry) (01/28/91)
Fast on the heels of Ben Haller's questions about Mac colors, I have a few of my own. In IM V, the Palette Manager talks about using animating colors in a windows's palette, and has an interface that looks really slick, reserving colors in the CLUT for you so that background windows won't go haywire when you pull your Mesmer trick (you remember Mesmer, right?) Anyway, due to the reserved nature of the colors, you have to use the Palette Manager's PmForeColor instead of RGBForeColor to do your drawing. I however, want to animate the colors of a PICT file, drawn with DrawPicture (), and DrawPicture only has opcodes for RGBForeColor, so my PICT (which is supposed to be 14 levels of pure blue) comes out as a mush of other 'nonreserved' colors, and fails to animate! Next step: go quick and dirty with Color Manager calls. Use SetEntries or RestoreEntries to change the ColorTable colors directly. Not too bad, except anything blue in the background is cycling from dark to bright too. But now, when I get an update event, the inverse table gets rebuilt (I think this is the problem), the pixel values for the updateRgn are all changed, and part of my picture is suddenly changing colors out of phase (light blue when it should be dark blue). Neat effect, but not what I'm looking for. Okay. Sorta lengthy explaination, but it seems to be a complex problem. I've tried saving and restoring the gDevice's ctSeed field but the MakeITable still seems to happen. I've tried reserving the entries with the ColorManager call, and dereserving them just before DrawPicture, but it's very slow and very ineffective. I haven't tried drawing to an offscreen pixmap and blasting, but I have no reason to think it'll help and several reasons to think it'll be difficult. Now, does anyone out there have any suggestions on now to make this thing work? If it matters--IIcx, Think C, 256 colors. Oh yeah. Ben. This is really messy, but I *think* you can find out the protect and reserve states by looking at the gDevice^^.gdPMap^^.pmTable^^.ctTable[index].value int, bits 7 (for protect) and 6 (for reserve). I'm not sure, this is from a quick look at ProtectEntry and ReserveEntry code in ROM with MacsBug, and my assembly's not the greatest. I'm also going to guess that ProtectEntry is rebuilding the inverse table every time (reasons unknown: it shouldn't) which is causing it to go very slow. If it's not that, it's the excessive number of indirections required to get to the right place. C'mon Apple--6 of them? X Windows only has 5 at most, and that's enough to make X programmers turn blue with rage. I've seen it. --Chall Fry cfry@jove.cs.pdx.edu "Chall, 'nifty' I can deal with, but 'goshums' is just too much." -Anastasia
mystone@mondo.engin.umich.edu (Dean Yu) (01/28/91)
In article <CFRY.91Jan28062706@jove.cs.pdx.edu> cfry@jove.cs.pdx.edu (Chall Fry) writes: > >Fast on the heels of Ben Haller's questions about Mac colors, I have a few >of my own. In IM V, the Palette Manager talks about using animating colors >in a windows's palette, and has an interface that looks really slick, >reserving colors in the CLUT for you so that background windows won't go >haywire when you pull your Mesmer trick (you remember Mesmer, right?) >Anyway, due to the reserved nature of the colors, you have to use the >Palette Manager's PmForeColor instead of RGBForeColor to do your drawing. I >however, want to animate the colors of a PICT file, drawn with DrawPicture >(), and DrawPicture only has opcodes for RGBForeColor, so my PICT (which is >supposed to be 14 levels of pure blue) comes out as a mush of other >'nonreserved' colors, and fails to animate! Next step: go quick and dirty >with Color Manager calls. Use SetEntries or RestoreEntries to change the >ColorTable colors directly. Not too bad, except anything blue in the I was banging my head against a wall trying to figure out how to do this about a year ago. The article on the Palette Manager in the first issue of d e v e l o p saved me from a prolonged headache. If you set the second most significant bit in ctFlags (I just woke up and can't remember if ctFlags is an integer or a longint), you'll be able to animate colours in your PICT resource. You'll have to mark the entries as animated still, however, but you won't have to go mucking about with the Colour Manager. _______________________________________________________________________________ Dean Yu | E-mail: mystone@mondo.engin.umich.edu Patches 'R' Us | Real-mail: Dean Yu A Division of Cyberite Systems | 909 Church St Apt C | Ann Arbor, MI 48104 I'm not the voice of Reason, much | Phone: 313 662-4073 less the voice of Cyberite. | 313 662-4163 -------------------------------------------------------------------------------