home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / sys / mac / programm / 18263 < prev    next >
Encoding:
Text File  |  1992-11-11  |  2.8 KB  |  68 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!elroy.jpl.nasa.gov!usc!sol.ctr.columbia.edu!eff!world!zobkiw
  3. From: zobkiw@world.std.com (Joe Zobkiw)
  4. Subject: CopyBits & Color Mapping
  5. Message-ID: <BxJwn3.DvM@world.std.com>
  6. Organization: The World Public Access UNIX, Brookline, MA
  7. Date: Wed, 11 Nov 1992 12:13:50 GMT
  8. Lines: 58
  9.  
  10. CopyBits and Color Mapping
  11.  
  12. I've created a 'ppat' resource using ResEdit with the standard 256
  13. color palette. It is 16x16 pixels in size and contains one solid
  14. color (rgb = 0xbbbb,0x0000,0x0000). When ResEdit saves the ppat
  15. resource it includes only one entry in it's color table (the
  16. correct entry), sets it's pixelSize field to 1 since the  pixMap
  17. data can be represented in 1 bit per pixel. The data is  all 0's
  18. and the 0th entry in the color table is the correct rgb value for
  19. the red mentioned above. This is logical.
  20.  
  21. I create an offscreen PixMap (using code from a tech note) that
  22. definitely works. The offscreen is created at 8 bits deep using the
  23. color table of the main device which (I assume) is the same
  24. standard 256 colors I used in ResEdit when in 8 bit color.
  25.  
  26. I pull some code antics to make a PixMap out of the ppat resource
  27. after getting it from a resource via GetPixPat(). For all intents
  28. and purposes I have a PixMap that is 100% valid for the mentioned
  29. ppat.
  30.  
  31. The Problem:
  32. When I CopyBits from the ppat pixMap to the new 8 bit offscreen
  33. pixMap, it SEEMS that CopyBits sees that pixelSize = 1 and
  34. therefore ignores  the color table associated with it. It then
  35. seems to see that since the pixMap data is all 0's it must be white
  36. and hence maps it to white in the destination 8 bit pixMap (entry 0
  37. in the destination color table). This is WRONG from what I WANT
  38. and EXPECT to happen! I expect that CopyBits will see that the ONE
  39. entry in the ppat is RED and will map it accordingly.
  40.  
  41. I've tried changing the foreground color and background color to
  42. the red in the ppat color table before CopyBits-ing and it has no
  43. effect.  Why is CopyBits not looking at the color table? This
  44. sounds like a  bug, is it documented? If the color table is there,
  45. it should be taken into account.
  46.  
  47. NOTE: If I use enough colors (more than 2) in the ppat to force
  48. pixelSize to be > 1 then everything works fine. This is what leads
  49. me to believe that CopyBits ignores the color table when pixelSize
  50. = 1.
  51.  
  52. FillCRect works fine, but it will be more of a pain for me to use
  53. this since I am parsing the ppat resources and donUt neccesarily
  54. want them aligned and whole in the destination. I also do not have
  55. a port to go with these offscreen pixMaps and do not want to create
  56. one.
  57.  
  58. Ideas? Confirmations? Flames? ;)
  59.  
  60. Thanks in advance.
  61.  
  62.  
  63. -- 
  64. -------------------------------------------------------------
  65. joe zobkiw         zobkiw@world.std.com        aol: aflzobkiw
  66.  
  67. macintosh.midi.synthesis.c.oop.asm.communications.graphics...
  68.