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
Application-Defined Routine /


MyColorSearch

Here's how to declare a color search function to supply to the SeedCFill or CalcCMask procedure if you were to name the function MyColorSearch:

FUNCTION MyColorSearch (rgb: RGBColor; 
                        position: LongInt): Boolean;
rgb
The RGBColor record for a pixel.
position
The position of the pixel within an image.
DESCRIPTION
Your color search function should analyze the RGBColor record passed to it in the rgb parameter. To mask a pixel approximating that color, your color search function should return TRUE; otherwise, it should return FALSE.

Your application should compare the RGBColor records that SeedCFill passes to your color search function against the RGBColor record for the pixel at the seed point you specify in that procedure's seedH and seedV parameters.

You can use a MatchRec record to determine the color of the seed pixel. When SeedCFill calls your color search function, the GDRefCon field of the current GDevice record (described in the chapter "Graphics Devices") contains a pointer to a MatchRec record that describes the seed point. This record has the following structure:

MatchRec = 
   RECORD
      red:        Integer; {red component of seed pixel}
      green:      Integer; {green component of seed pixel}
      blue:       Integer; {blue component of seed pixel}
      matchData:  LongInt; {value in matchData parameter of }
                           { SeedCFill procedure}
   END;
The matchData field contains whatever value you pass to SeedCFill in the matchData parameter. 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 color for the pixel currently under analysis matches any of the colors in the table.

Similarly, your application should compare the colors that CalcCMask passes to your color search function against the color that you specify in that procedure's seedRGB parameter. When CalcCMask calls your color search function, the GDRefCon field of the current GDevice record (described in the chapter "Graphics Devices") contains a pointer to a MatchRec record for your seed color. The matchData field of this record contains whatever value you pass to CalcCMask in the matchData parameter.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996