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 theSeedCFillorCalcCMaskprocedure if you were to name the functionMyColorSearch:
FUNCTION MyColorSearch (rgb: RGBColor; position: LongInt): Boolean;
- rgb
- The
RGBColorrecord for a pixel.position- The position of the pixel within an image.
DESCRIPTION
Your color search function should analyze theRGBColorrecord passed to it in thergbparameter. To mask a pixel approximating that color, your color search function should returnTRUE; otherwise, it should returnFALSE.Your application should compare the
RGBColorrecords thatSeedCFillpasses to your color search function against theRGBColorrecord for the pixel at the seed point you specify in that procedure'sseedHandseedVparameters.You can use a
MatchRecrecord to determine the color of the seed pixel. WhenSeedCFillcalls your color search function, theGDRefConfield of the currentGDevicerecord (described in the chapter "Graphics Devices") contains a pointer to aMatchRecrecord 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;ThematchDatafield contains whatever value you pass toSeedCFillin thematchDataparameter. In thematchDataparameter, 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
CalcCMaskpasses to your color search function against the color that you specify in that procedure'sseedRGBparameter. WhenCalcCMaskcalls your color search function, theGDRefConfield of the currentGDevicerecord (described in the chapter "Graphics Devices") contains a pointer to aMatchRecrecord for your seed color. ThematchDatafield of this record contains whatever value you pass toCalcCMaskin thematchDataparameter.