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 theCalcCMaskprocedure, 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
PixMaprecord to aBitMaprecord.dstBits- The destination image, a
BitMaprecord.srcRect- The rectangle of the source image.
dstRect- The rectangle of the destination image.
seedRGB- An
RGBColorrecord specifying the color for pixels that should not be filled.matchProc- An optional matching procedure.
matchData- Data for the optional matching procedure.
DESCRIPTION
TheCalcCMaskprocedure generates a mask showing where pixels in an image cannot be filled from any of the outer edges of the rectangle you specify. TheCalcCMaskprocedure returns this mask in thedstBitsparameter. 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, andCopyDeepMaskprocedures.You specify a source image in the
srcBitsparameter, and in thesrcRectparameter you specify a rectangle within that source image. Starting from the edges of this rectangle,CalcCMaskcalculates which pixels cannot be filled. By default,CalcCMaskreturns 1's in the mask to indicate which pixels have the exact color that you specify in theseedRGBparameter, 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
srcBitscontains a dark blue rectangle on a red background, and your application setsseedRGBequal to dark blue, thenCalcCMaskreturns 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
matchProcandmatchDataparameters to 0,CalcCMaskuses the exact color specified in theRGBColorrecord that you supply in theseedRGBparameter. You can customizeCalcCMaskby writing your own color search function and pointing to it in thematchProcprocedure; your color search function might, for example, search for colors that approximate the color specified in theRGBColorrecord. As withSeedCFill, you can then use thematchDataparameter in any manner useful for your application.The
CalcCMaskprocedure does not scale--the source and destination rectangles must be the same size. Calls toCalcCMaskare 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 theCalcCMaskprocedure.