[comp.sys.mac.programmer] PICT BitMap/PixMap overlap

moreland@happy.sdsc.edu (John Moreland) (06/27/91)

Hello Knows-PICTers,

I need to know how to draw the bits of an "overlaping" PixMap/BitMap for
a PICT image.  I'm developing code to parse PICT images on a UNIX platform
and I need to know what to do with pixels from a PackPixRect or PackBitsRect
opcode that are the same as color as the "background" color.

If I draw a PixMap on top of some preveously drawn graphics and the PixMap
has "blank" areas (white), should all white pixels in the image be ignored
(in which case you could "see through" the white areas of the PixMap)
or should they be DRAWN as white (in which case the white pixels
overwrite any previously drawn graphics) ?

Does the PixMap's "penmode" (copybits transfer mode) tell me this ?  HOW ?
Does the current QuickDraw background color effect whether or not you can
"see through" a PixMap/BitMap ?  HOW ?

Please Help,
John

-- 
 _____                                                                   _____
( ___ )-----------------------------------------------------------------( ___ )
 |   |                                      ||    moreland@sdsc.edu      |   |
 |   |          />                          |+===========================|   |
 |   |         /<                  Kcah Cam || John L. Moreland          |   |
 |   | [\\\\\\(O):::<=====================- || San Diego Supercomputer   |   |
 |   |         \<       Fighter/Ma(gi)cUser ||    Center (SDSC)          |   |
 |   |          \>                          || AppleLink:  D6812         |   |
 |___|                                      || Phone: (619) 534-5170     |___|
(_____)-----------------------------------------------------------------(_____)

smoke@well.sf.ca.us (Nicholas Jackiw) (06/28/91)

In article <474@nic.cerf.net> moreland@happy.sdsc.edu (John Moreland) writes:
>Hello Knows-PICTers,
>
>If I draw a PixMap on top of some preveously drawn graphics and the PixMap
>has "blank" areas (white), should all white pixels in the image be ignored
>(in which case you could "see through" the white areas of the PixMap)
>or should they be DRAWN as white (in which case the white pixels
>overwrite any previously drawn graphics) ?
>
>Does the PixMap's "penmode" (copybits transfer mode) tell me this ?  HOW ?
>
Yes; it all depends on the transfer mode.  In a straight-forward srcCopy
mode, you replace all bits in the destination with those from the source,
including white (or more properly, the port's backcolor).  There are
many different possibilities for penmode, however.  Originally, there
were some (eight?) that were simple logical operations; these are
described in Inside Mac I (Quickdraw chapter).  With the Mac II, they
introduced a number of arithmetic drawing modes, which were better
suited for color.  These, and their considerably hairier internal
mechanisms, are documented in Inside Mac V (Color Quickdraw chapter).
Then, when System 7 arrived, they *revised* how the original (logical)
modes operate in a color environment, retroactively invalidating many
PICTs and PICT-drawing programs.  For this you'll be thumbing through
Inside Mac VI, chapter 17.  

Once you've worked all this out (by tomorrow, we hope), don't forget
the special colorization effects that CopyBits can have when
foreColor and backColor are set to non-default values.  Again, how this
works differs between System 7 and previous systems, so you'll have
to special case not just on the transfer mode, but also on the system
which created the picture *and* the system for which the picture was
intended *and* the various colorization effects *and* etc.

CopyBits is the beast that drives your Macintosh; I don't envy you
having to duplicate it.  In terms of your original query, though,
bitmaps-with-holes won't appear in PICTs; there you're talking about
selective masking, not logical/arithmetical/hocus-pocuskal bitmap
combination.  All of the masking bitmap functions fail to record in
PICTs (cf CopyMask, CopyDeepMask, etc.).




-- 
                              --- * ---
Nick Jackiw                  Smoke@well.sf.ca.us   | Jackiw@cs.swarthmore.edu
Key Curriculum Press, Inc.   Applelink:KEY.EDUSOFT | (415) 548-2304
                              --- * ---