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 4 - Color QuickDraw / Color QuickDraw Reference
Color QuickDraw Routines / Calculating Color Fills


To determine how far filling will extend to pixels matching the color of a particular pixel, use the SeedCFill procedure.

PROCEDURE SeedCFill (srcBits,dstBits: BitMap; 
                     srcRect,dstRect: Rect; seedH,seedV: Integer; 
                     matchProc: ProcPtr; matchData: LongInt);
The source image. If the image is in a pixel map, you must coerce its PixMap record to a BitMap record.
The destination mask.
The rectangle of the source image.
The rectangle of the destination image.
The horizontal position of the seed point.
The vertical position of the seed point.
An optional color search function.
Data for the optional color search function.
The SeedCFill procedure generates a mask showing where the pixels in an image can be filled from a starting point, like the paint pouring from the MacPaint paint-bucket tool. The SeedCFill procedure returns this mask in the dstBits parameter. This mask is a bitmap filled with 1's to indicate all pixels adjacent to a seed point whose colors do not exactly match the RGBColor record for the pixel at the seed point. You can then use this mask with the CopyBits, CopyMask, and CopyDeepMask procedures.

You specify a source image in the srcBits parameter, and in the srcRect parameter you specify a rectangle within that source image. You specify where to begin seeding in the seedH and seedV parameters, which must be the horizontal and vertical coordinates of a point in the local coordinate system of the source bitmap. By default, the 1's returned in the mask indicate all pixels adjacent to the seed point whose pixel values do not exactly match the pixel value of the pixel at the seed point. To use this default, set the matchProc and matchData parameters to 0.

In generating the mask, SeedCFill uses the CopyBits procedure to convert the source image to a 1-bit mask. The SeedCFill procedure installs a default color search function that returns 0 if the pixel value matches that of the seed point; all other pixel values return 1's.

The SeedCFill procedure does not scale: the source and destination rectangles must be the same size. Calls to SeedCFill are not clipped to the current port and are not stored into QuickDraw pictures.

You can customize SeedCFill by writing your own color search function and pointing to it in the matchProc procedure; SeedCFill will then use your procedure instead of the default. You can use the matchData parameter for whatever you'd like. In the matchData parameter, for instance, your application could pass the handle to a color table. Your color search function could then check whether the pixel value for the pixel currently under analysis matches any of the colors in the table.

See "Application-Defined Routine" on page 4-92 for a description of how to customize the SeedCFill procedure.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996