Important: The information in this document is obsolete and should not be used for new development.
MyColorSearch
Here's how to declare a color search function to supply to theSeedCFill
orCalcCMask
procedure if you were to name the functionMyColorSearch:
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 theRGBColor
record passed to it in thergb
parameter. To mask a pixel approximating that color, your color search function should returnTRUE
; otherwise, it should returnFALSE
.Your application should compare the
RGBColor
records thatSeedCFill
passes to your color search function against theRGBColor
record for the pixel at the seed point you specify in that procedure'sseedH
andseedV
parameters.You can use a
MatchRec
record to determine the color of the seed pixel. WhenSeedCFill
calls your color search function, theGDRefCon
field of the currentGDevice
record (described in the chapter "Graphics Devices") contains a pointer to aMatchRec
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;ThematchData
field contains whatever value you pass toSeedCFill
in thematchData
parameter. In thematchData
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'sseedRGB
parameter. WhenCalcCMask
calls your color search function, theGDRefCon
field of the currentGDevice
record (described in the chapter "Graphics Devices") contains a pointer to aMatchRec
record for your seed color. ThematchData
field of this record contains whatever value you pass toCalcCMask
in thematchData
parameter.