home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!elroy.jpl.nasa.gov!usc!sol.ctr.columbia.edu!eff!world!zobkiw
- From: zobkiw@world.std.com (Joe Zobkiw)
- Subject: CopyBits & Color Mapping
- Message-ID: <BxJwn3.DvM@world.std.com>
- Organization: The World Public Access UNIX, Brookline, MA
- Date: Wed, 11 Nov 1992 12:13:50 GMT
- Lines: 58
-
- CopyBits and Color Mapping
-
- I've created a 'ppat' resource using ResEdit with the standard 256
- color palette. It is 16x16 pixels in size and contains one solid
- color (rgb = 0xbbbb,0x0000,0x0000). When ResEdit saves the ppat
- resource it includes only one entry in it's color table (the
- correct entry), sets it's pixelSize field to 1 since the pixMap
- data can be represented in 1 bit per pixel. The data is all 0's
- and the 0th entry in the color table is the correct rgb value for
- the red mentioned above. This is logical.
-
- I create an offscreen PixMap (using code from a tech note) that
- definitely works. The offscreen is created at 8 bits deep using the
- color table of the main device which (I assume) is the same
- standard 256 colors I used in ResEdit when in 8 bit color.
-
- I pull some code antics to make a PixMap out of the ppat resource
- after getting it from a resource via GetPixPat(). For all intents
- and purposes I have a PixMap that is 100% valid for the mentioned
- ppat.
-
- The Problem:
- When I CopyBits from the ppat pixMap to the new 8 bit offscreen
- pixMap, it SEEMS that CopyBits sees that pixelSize = 1 and
- therefore ignores the color table associated with it. It then
- seems to see that since the pixMap data is all 0's it must be white
- and hence maps it to white in the destination 8 bit pixMap (entry 0
- in the destination color table). This is WRONG from what I WANT
- and EXPECT to happen! I expect that CopyBits will see that the ONE
- entry in the ppat is RED and will map it accordingly.
-
- I've tried changing the foreground color and background color to
- the red in the ppat color table before CopyBits-ing and it has no
- effect. Why is CopyBits not looking at the color table? This
- sounds like a bug, is it documented? If the color table is there,
- it should be taken into account.
-
- NOTE: If I use enough colors (more than 2) in the ppat to force
- pixelSize to be > 1 then everything works fine. This is what leads
- me to believe that CopyBits ignores the color table when pixelSize
- = 1.
-
- FillCRect works fine, but it will be more of a pain for me to use
- this since I am parsing the ppat resources and donUt neccesarily
- want them aligned and whole in the destination. I also do not have
- a port to go with these offscreen pixMaps and do not want to create
- one.
-
- Ideas? Confirmations? Flames? ;)
-
- Thanks in advance.
-
-
- --
- -------------------------------------------------------------
- joe zobkiw zobkiw@world.std.com aol: aflzobkiw
-
- macintosh.midi.synthesis.c.oop.asm.communications.graphics...
-