CopyMask
CopyMask Copy between bitMaps or pixMaps, using masking bitMap
#include <Quickdraw.h> Color Quickdraw
void CopyMask(srcMap, maskMap, destMap, srcRect, maskRect, destRect );
BitMap *srcMap ; address of BitMap or pixMap of source image
storage
BitMap *maskMap ; address of BitMap identifying mask
BitMap *destMap ; address of BitMap or pixMap to receive masked
image
Rect *srcRect ; position and size of source image
Rect *maskRect ; position and size of masking area
Rect *destRect ; position and size of destination area
CopyMask copies image data from one bitMap or pixMap to an other, under
control of a mask. Bits are copied from srcMap to destMap only where
maskMap is a 1. For the 256K ROMs, CopyMask accepts both bitMaps and
pixMaps as either the source or the destination. However, the maskBits have to
be in the form of a bitMap.
srcMap and . . .
maskMap and . . .
destMap are addresses of 14-byte BitMap structures. The memory
pointed to by srcMap.baseAddr contains the source image; the image
will be logically ANDed with data at maskMap.baseAddr and the
resulting bits are copied into the memory addressed by
destMap.baseAddr.
srcRect and . . .
maskRect and . . .
destRect are the addresses of 8-byte Rect structures. Each identifies the
size and position within its respective bitMap or pixMap. In Color
QuickDraw, the source and mask can be stretched to fit the size of the
destination. Remember, however, that the source and the mask still
need to be the same size.
Returns: none

Notes: This function is used, along with CalcMask, to implement the "lasso
feature of many paint programs. This is great for handling bit copies that
require a complex clipping area; it's much faster than CopyBits.
srcMap maskMap destMap
If destMap belongs to the current CGrafPort or GrafPort, then the image is
clipped to its visRgn, portRect, and bitMap.bounds rectangle as well as
being masked by the data in maskMap.
Note: In the 128K ROMs, all three rectangles should be the same size; no
scaling is performed. In the 256K ROMs, Color Quickdraw correctly
stretches or shrinks the the source and mask data to fit the destRect. Still,
the source and the mask need to be the same size.
The srcMap and destMap may be the same, but the rectangles should not
overlap (no warning is given; you have to know this beforehand). If the
source and destination GrafPorts overlap, you may need to convert srcRect
and destRect to global coordinates (see LocalToGlobal) and specify
screenBits for both bitMap parameters).
Remember to set the foreground to black and the background to white
during Color QuickDraw CopyBits operations since, otherwise unwanted
colors may be applied to the image when it is copied.
The maskMap is typically an off-screen bitMap or pixMap (see