Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Imaging With QuickDraw /
Chapter 3 - QuickDraw Drawing / QuickDraw Drawing Reference
Routines / Calculating Black-and-White Fills


To determine where filling will not occur when filling from the outside of a rectangle, use the CalcMask procedure.

PROCEDURE CalcMask (srcPtr,dstPtr:\xDDPtr; 
A pointer to the source bit image.
A pointer to the destination bit image.
Row width of the source bitmap.
Row width of the destination bitmap.
Height (in pixels) of the fill rectangle.
Width (in words) of the fill rectangle.
The CalcMask procedure produces a bit image with 1's in all pixels to which paint could not flow from any of the outer edges of the rectangle. You can use this bit image as a mask with the CopyBits or CopyMask procedure. As illustrated in Figure 3-26, a hollow object produces a solid mask, but an open object produces a mask of itself.

Figure 3-26 A source image and the resulting mask produced by the CalcMask procedure

As with the SeedFill procedure, point to the bit image you want to fill with the srcPtr parameter, which can point to the image's base address or a word boundary within the image. Specify a pixel height and word width with the height and words parameters to define a fill rectangle that delimits the area you want to fill. The fill rectangle can be the entire bit image or a subset of it. Point to a destination image with the dstPtr parameter. Specify the row widths of the source and destination bitmaps (their rowBytes values) with the srcRow and dstRow parameters. (The bitmaps can be different sizes, but they must be large enough to contain the fill rectangle at the origins specified by srcPtr and dstPtr.)

Figure 3-25 on page 3-106 illustrates the parameters for the source and destination bit images.

Calls to CalcMask are not clipped to the current port and are not stored into QuickDraw pictures.

For color graphics ports, use the CalcCMask procedure, which is described in the chapter "Color QuickDraw."

Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996