home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / sys / mac / programm / 21896 < prev    next >
Encoding:
Text File  |  1993-01-21  |  2.8 KB  |  59 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!spool.mu.edu!yale.edu!yale!gumby!kzoo!k044477
  3. From: k044477@hobbes.kzoo.edu (Jamie R. McCarthy)
  4. Subject: Re: Color animation in After Dark...HELP!
  5. Message-ID: <1993Jan21.200541.29437@hobbes.kzoo.edu>
  6. Organization: Kalamazoo College
  7. References: <Jan21.055623.50848@yuma.ACNS.ColoState.EDU>
  8. Date: Thu, 21 Jan 1993 20:05:41 GMT
  9. Lines: 48
  10.  
  11. cantrell@lamar.ColoState.EDU (Carol Cantrell) writes:
  12. >I'm writing an After Dark module that uses color table animation. ...
  13. >I want to copy the GWorlds to the screen color index for color index--
  14. >that is, color #1 in the GWorld is color [#1] on the screen, etc.
  15. >The obvious way to do this is to OR the ctFlags field with $4000;
  16.  
  17. Not _that_ obvious;  it's hidden pretty well in IM VI, actually.  :-)
  18.  
  19. >however, this copies index numbers from the GWorld to index numbers
  20. >in the current PALETTE.  After Dark doesn't draw into a WINDOW, and therefore
  21. >DOESN'T HAVE A PALETTE!!!   Is there any way to do this?  Help!
  22.  
  23. Yep, there are three ways to get the Color Indices You Want up onto the
  24. screen:
  25.     (1) Set bit 14 in ctFlags;
  26.     (2) Make the ctSeeds equal;
  27.     (3) Write directly to the screen.
  28.  
  29. (1) won't work for you, as you say, because AD opens a port not a
  30. palette.  (Actually, does it even do that?  Someone said it uses
  31. SetStdProcs() to redirect QD calls to its own nefarious ends.  I don't
  32. even want to think about that.)
  33.  
  34. (2) is probably your best bet in this case.  If the ctSeed in your
  35. source pixmap's color table is equal to the ctSeed in your dest pixmap's
  36. color table, CopyBits will take this to mean that the color tables are
  37. in fact equal.  It will not run through them and check.  Consequently,
  38. it will just copy the pixel values straight across, which has the effect
  39. you want.  (And, as a side dish, it's also the fastest possible way that
  40. CopyBits can operate.)
  41.  
  42. You can set the ctSeeds yourself, manually, if you like.  Normally,
  43. that's not a good idea, but After Dark is such a snuggly, hand-holding
  44. environment to work in, that I won't even give you the usual "now don't
  45. do this" warning.  All you gotta do is drop a 'clut' in your module with
  46. the appropriate resource ID, set a few flags, maybe check the screen
  47. depth yourself, and you're guaranteed to have the screen you want, with
  48. the colors you want.  So--do the checks, copy the screen's pixmap's
  49. pmTable's ctSeed into your GWorld's pixmap's pmTable's ctSeed, and
  50. CopyBits to your heart's content.
  51.  
  52. Alternatively, you can build a GWorld using the screen's pmTable.  But
  53. I'm not too familiar with GWorlds, so you're on your own there.
  54. -- 
  55.  Jamie McCarthy      Internet: k044477@kzoo.edu      AppleLink: j.mccarthy
  56.  "We enjoy a patent portfolio second to none in the computer industry,
  57.   with some 30,000 patents worldwide and more than 9,000 in the U.S. alone,
  58.   and growing."                      - An IBM advertisement
  59.