home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / sys / mac / programm / 15299 < prev    next >
Encoding:
Text File  |  1992-09-10  |  3.0 KB  |  68 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!caen!sol.ctr.columbia.edu!sol.ctr.columbia.edu!mhall
  3. From: mhall@occs.cs.oberlin.edu (Matthew Hall)
  4. Subject: The Pallette manager
  5. Organization: Oberlin College Computer Science
  6. Message-ID: <MHALL.92Sep8155808@occs.cs.oberlin.edu>
  7. Distribution: comp.sys.mac.programmer
  8. Sender: news@ctr.columbia.edu (The Daily Lose)
  9. Date: Tue, 8 Sep 1992 20:58:08 GMT
  10. X-Posted-From: occs.cs.oberlin.edu
  11. X-Posted-Through: sol.ctr.columbia.edu
  12. Lines: 54
  13.  
  14.  
  15. I have a question that's not directly related to the games thread, but
  16. its close.
  17.  
  18. I am drawing a 256 color plot in an offscreen pixmap.  I set the
  19. offscreen pmtable to whatever clut I wish to choose.  Then, from that
  20. I creat a palette optimized for the current color level (or none for
  21. direct devices).  So, if I'm in 16 colors, I would take one of every
  22. 16 colors in the 256 color clut that I loaded in (with black and white
  23. appropriately placed) and place them in the palette. Then I set the
  24. app's default palette to this new palette.
  25.  This way, I can
  26. draw directly into the offscreen map since the positions of the colors
  27. in the clut don't change, and I don't have to use
  28. pmtolerant+pmexplicit, or setentries, and I can draw in an ideal color
  29. environment and let PM take care of tolerance and updates.  Now - two problems
  30.  
  31. It runs very oddly in the system 7 finder.  Sometimes the menus are
  32. dimmed by gray color, sometimes by gray pattern.  When I switch to the
  33. finder, sometimes dimmed menus are displayed as an attrocious shade of
  34. magenta.  I guess in the previous thread it says that the finder is
  35. "courteous to the point of obsequity", but magenta menus?
  36.  
  37. Also, I want to create a black background offscreen, I switch to the 
  38. offscreen port.  I call a fillrect (backpat=black,backcolor=0,0,0);
  39. and then copybits to the screen.(with the window as the current port)
  40. At this point, the cluts first and last entries are white and black
  41. respectively.  If I am in an indexed environment, everything is
  42. hunky-dory. If I am in a direct environment, the background stays
  43. white, and if I switch between the two, I usually get a cyan  (one of
  44. the earlier entries in my clut). 
  45.  Now when I draw direct (plug index values in the data) into the
  46. pixmap, and copybits to the screen 
  47. everything is fine. $FF turns to black, etc.  So the problem seems to
  48. be that fillrect is placing the (teh) wrong index into the pixmap.  Is
  49. this because my offscreen port is using the current gdevice, and
  50. thinks black is somewhere else in my clut than it actually is? If so,
  51. do I have to create a new gdevice for the pixmap?  
  52. Actually, is my method compatible? Is it stupid?  and why the strange
  53. problems.
  54.  
  55. Any help appreciated,
  56. -matt hall
  57. --
  58.  
  59.  
  60. -------------------------------------------------------------------------------
  61. Matt Hall.    mhall@occs.cs.edu  OR  SMH9666@OBERLIN.BITNET
  62.               (216)-775-5805 (That's a Cleveland Area code. Lucky Me)
  63.  
  64. "If a man comes up to you and says:
  65.     'A dog just carried away your ear.'
  66. Do you run after the dog, or search first for your ear?" - Moon over Morocco
  67.   
  68.