Important: The information in this document is obsolete and should not be used for new development.
CalcCMask
To determine where filling will not occur when filling from the outside of a rectangle, you can use theCalcCMask
procedure, which indicates pixels that match, or are surrounded by pixels that match, a particular color.
PROCEDURE CalcCMask (srcBits,dstBits: BitMap; srcRect,dstRect: Rect; seedRGB: RGBColor; matchProc: ProcPtr; matchData: LongInt);
srcBits
- The source image. If the image is in a pixel map, you must coerce its
PixMap
record to aBitMap
record.dstBits
- The destination image, a
BitMap
record.srcRect
- The rectangle of the source image.
dstRect
- The rectangle of the destination image.
seedRGB
- An
RGBColor
record specifying the color for pixels that should not be filled.matchProc
- An optional matching procedure.
matchData
- Data for the optional matching procedure.
DESCRIPTION
TheCalcCMask
procedure generates a mask showing where pixels in an image cannot be filled from any of the outer edges of the rectangle you specify. TheCalcCMask
procedure returns this mask in thedstBits
parameter. This mask is a bitmap filled with 1's only where the pixels in the source image cannot be filled. You can then use this mask with theCopyBits
,CopyMask
, andCopyDeepMask
procedures.You specify a source image in the
srcBits
parameter, and in thesrcRect
parameter you specify a rectangle within that source image. Starting from the edges of this rectangle,CalcCMask
calculates which pixels cannot be filled. By default,CalcCMask
returns 1's in the mask to indicate which pixels have the exact color that you specify in theseedRGB
parameter, as well as which pixels are enclosed by shapes whose outlines consist entirely of pixels with this color.For instance, if the source image in
srcBits
contains a dark blue rectangle on a red background, and your application setsseedRGB
equal to dark blue, thenCalcCMask
returns a mask with 1's in the positions corresponding to the edges and interior of the rectangle, and 0's outside of the rectangle.If you set the
matchProc
andmatchData
parameters to 0,CalcCMask
uses the exact color specified in theRGBColor
record that you supply in theseedRGB
parameter. You can customizeCalcCMask
by writing your own color search function and pointing to it in thematchProc
procedure; your color search function might, for example, search for colors that approximate the color specified in theRGBColor
record. As withSeedCFill
, you can then use thematchData
parameter in any manner useful for your application.The
CalcCMask
procedure does not scale--the source and destination rectangles must be the same size. Calls toCalcCMask
are not clipped to the current port and are not stored into QuickDraw pictures.SEE ALSO
See "Application-Defined Routine" on page 4-92 for a description of how to customize theCalcCMask
procedure.