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

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!elroy.jpl.nasa.gov!sdd.hp.com!caen!sol.ctr.columbia.edu!sol.ctr.columbia.edu!mhall
  3. From: mhall@occs.cs.oberlin.edu (Matthew Hall)
  4. Subject: Re: The Pallette manager
  5. Organization: Oberlin College Computer Science
  6. In-Reply-To: ldo@waikato.ac.nz's message of 11 Sep 92 18:18:06 +1200
  7. References: <MHALL.92Sep8155808@occs.cs.oberlin.edu> <1992Sep11.181806.10762@waikato.ac.nz>
  8. Message-ID: <MHALL.92Sep11162809@occs.cs.oberlin.edu>
  9. Distribution: comp.sys.mac.programmer
  10. Sender: nobody@ctr.columbia.edu
  11. Date: Fri, 11 Sep 1992 21:28:09 GMT
  12. X-Posted-From: occs.cs.oberlin.edu
  13. X-Posted-Through: sol.ctr.columbia.edu
  14. Lines: 71
  15.  
  16. In article <1992Sep11.181806.10762@waikato.ac.nz> ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) writes:
  17.  
  18. >
  19. >   >  This way, I can
  20. >   > draw directly into the offscreen map since the positions of the colors
  21. >   > in the clut don't change, and I don't have to use
  22. >   > pmtolerant+pmexplicit, or setentries, and I can draw in an ideal color
  23. >   > environment and let PM take care of tolerance and updates.
  24. >
  25. >   Hang on--you don't need a palette for an offscreen port. The main point of
  26. >   palettes is for use with on-screen windows. The only point with attaching
  27. >   a palette to an offscreen port would be so you can use PmForeColor and
  28. >   PmBackColor to quickly specify colours from the palette. Tolerant and
  29. >   animated entries don't mean anything in an offscreen palette.
  30. >
  31. I should have been clearer.  I load a 256 color pallette from a
  32. resource file with GetCTable.  Then I set
  33. Offscreen^.portpixmap^^.pmtable equal to that clut.  Then, I create a
  34. palette for the current screen depth, and fill it with values from the
  35. clut.  The palette is only for the window that the plot will
  36. eventually be displayed in.  I draw in the offscreen pixmap by
  37. directly setting the bytes.  If I loaded a gray scale, then the level
  38. of gray is from 0-255.  I just place that byte in the pixmap data.
  39. When I am done, I call copybits from the port to the screen.
  40.  
  41.  
  42.  
  43. >   What exactly *is* your method? If you're directly poking colour table
  44. >   entries, are you remembering to call CTabChanged so QuickDraw knows what
  45. >   you've been up to? 
  46.  
  47. No I haven't.  I didn't even know I was supposed to.  Thanks.
  48.  
  49. >If you want a custom colour table for your pixmap, then
  50. >  *YES*, you *DO* have to create a custom GDevice. This is because the mapping
  51. >  from the colours you ask for to actual pixel values is done using an inverse
  52. > colour table, and you find those in the GDevice structure, not in the PixMap.
  53. >
  54. >Are you using the GWorld routines? If not, I highly recommend them. Here's how
  55. >   you create a GWorld:
  56.  
  57. The problem is that I want this to be compatible with as many
  58. computers as it can.  GWorlds are only in sys 7 and 32 bit quickdraw
  59. equipped Macs.  Inhibited colors are only in systems 6.0.5 and later.
  60. I may be able to assume that anyone running color should be running
  61. 6.0.5, so maybe I will use inhibited colors, and just create one
  62. palette, but I don't want to assume system 7, or 32-bit QD.
  63. Of course, my compatibility concerns are worthless if my method
  64. crashes most computers or graphics cards.  It works on an LC tho'
  65.  
  66. I guess I will have to create a gDevice for the offscreen port then.
  67. The only quickdraw call I make, besides copybits, is fillrect though.
  68. Otherwise I just poke in numbers.  it seems kind of a waste of memory
  69. to create a GDevice just for FillRect when otherwise things seem to be
  70. working well.  I can't see any problems with accelerator cards since I
  71. don't modify screen data directly.  
  72.  
  73. Thanks for the help
  74. -matt hall
  75.  
  76. --
  77.  
  78.  
  79. -------------------------------------------------------------------------------
  80. Matt Hall.    mhall@occs.cs.edu  OR  SMH9666@OBERLIN.BITNET
  81.               (216)-775-5805 (That's a Cleveland Area code. Lucky Me)
  82.  
  83. "If a man comes up to you and says:
  84.     'A dog just carried away your ear.'
  85. Do you run after the dog, or search first for your ear?" - Moon over Morocco
  86.   
  87.