home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / sys / mac / programm / 19945 < prev    next >
Encoding:
Text File  |  1992-12-16  |  1.6 KB  |  41 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!spool.mu.edu!umn.edu!csus.edu!netcom.com!ray
  3. From: ray@netcom.com (Ray Fischer)
  4. Subject: Re: HELP: Speedup SetCPixel
  5. Message-ID: <1992Dec17.023831.5227@netcom.com>
  6. Organization: Netcom. San Jose, California
  7. References: <1992Dec16.081024.2403@aragorn.unibe.ch>
  8. Date: Thu, 17 Dec 1992 02:38:31 GMT
  9. Lines: 30
  10.  
  11. KOHLER@IOC.unibe.ch writes ...
  12. >Hi there!
  13.  
  14. Dude!
  15.  
  16. >I'm writing a program that should be able to read a file of characters
  17. >and display for each of them a pixel in the corresponding color (8 bit).
  18. >
  19. >The problem is: IT'S VERY SLOW ....
  20.  
  21. Yup.  For each 8-bit pixel you put into the buffer, Quickdraw has to
  22. take the 48-bit color you gave it and use a reverse-index table to get
  23. the actual pixel value (which will be an index into the color lookup
  24. table).  It also figures out where in the offscreen GWorld the pixel
  25. belongs and checks for any clipping.
  26.  
  27. The trick to make this process go faster is to do as much of it as
  28. possible only once at the beginning.  For example, if character 'X'
  29. turn into blue, then one way to do all this a lot faster would be to
  30. create a table at the beginning indexed by character and returning a 
  31. pixel value.  Then store this pixel value directly into the offscreen 
  32. GWorld's pixmap.
  33.  
  34. I'll leave the details as an exercise (I always hated that phrase when
  35. I was a student, but now's not the time to do the research myself.
  36. Look at the Color Quickdraw and Pallette Manager chapters in IM V)
  37.  
  38. -- 
  39. Ray Fischer                   "Convictions are more dangerous enemies of truth
  40. ray@netcom.com                 than lies."  -- Friedrich Nietszsche
  41.