# Wrappers The wrappers include contains wrapper functions used throughout SRL, some of them to simplify coding while others are just fixes. The source for this file can be found `here `_. - - - ## GetClientBounds() ```pascal function GetClientBounds(): TBox; ``` Returns the clients bounds. ```{note} By Olly ``` Example: ```pascal b := GetClientBounds(); ``` - - - ## GetColor; overload ```pascal function GetColor(const p: TPoint): Integer; overload; ``` Takes a TPoint variable instead of x, y variables. ```{note} By Olly ``` Example: ```pascal p := Point(350, 200); WriteLn(GetColor(p)); ``` - - - ## GetColors; overload ```pascal function GetColors(const TPA: TPointArray; const ClearSame: boolean): TIntegerArray; overload; ``` Takes an extra parameter, clearSame if true will clear the same integers in the result. ```{note} By Olly ``` Example: ```pascal Colors := GetColors(TPA, True); ``` - - - ## FindColor; overload ```pascal function FindColor(var x, y: integer; const Color: integer; const SearchBox: TBox): Boolean; overload; ``` Takes a TBox variable instead of x1, y1, x2 and y2 variables. ```{note} By Coh3n ``` Example: ```pascal FindColor(x, y, clRed, Box); ``` - - - ## findColorTolerance; overload ```pascal function FindColorTolerance(var x, y: Integer; const Color: Integer; const SearchBox: TBox; const Tolerance: Integer): Boolean; overload; ``` Takes a TBox variable instead of x1, y1, x2 and y2 variables. ```{note} By Olly ``` Example: ```pascal FindColorTolerance(x, y, 255, Box, 10); ``` - - - ## FindColors; overload ```pascal function FindColors(var Points: TPointArray; const Color: Integer; const SearchBox: TBox): Boolean; overload; ``` Takes a TBox variable instead of x1, y1, x2 and y2 variables. ```{note} By Coh3n ``` Example: ```pascal WriteLn(FindColors(TPA, 255, Box)); ``` - - - ## FindColorsTolerance; overload ```pascal function FindColorsTolerance(var Points: TPointArray; const Color: Integer; const SearchBox: TBox; const Tolerance: Integer): Boolean; overload; ``` Takes a TBox variable instead of x1, y1, x2 and y2 variables. ```{note} By Zyt3x ``` Example: ```pascal WriteLn(FindColorsTolerance(TPA, 255, Box, 10)); ``` - - - ## CountColor; overload ```pascal function CountColor(const Color: Integer; const SearchBox: TBox): Integer; overload; ``` Takes a TBox variable instead of x1, y1, x2 and y2 variables. ```{note} By Coh3n ``` Example: ```pascal WriteLn(CountColor(clRed, Box)); ``` - - - ## CountColorTolerance: overload; ```pascal function CountColorTolerance(Color: integer; searchBox: TBox; tol: integer): Boolean; overload; ``` Takes a TBox variable instead of x1, y1, x2 and y2 variables. ```{note} By Coh3n ``` Example: ```pascal WriteLn(CountColorTolerance(clRed, 10, Box)); ``` - - - ## BitmapFromClient; overload ```pascal function BitmapFromClient(const SearchBox: TBox): Integer; overload; ``` Takes a TBox variable instead of x1, y1, x2 and y2 variables. ```{note} By Olly ``` Example: ```pascal BMP := BitmapFromClient(Box); ``` - - - ## FindBitmapIn; overload ```pascal function FindBitmapIn(const BMP: Integer; var x, y: integer; const SearchBox: TBox): Boolean; overload; ``` Takes a TBox variable instead of x1, y1, x2 and y2 variables. ```{note} By Olly ``` Example: ```pascal Result := FindBitmap(bmp, x, y, Box); ``` - - - ## FindBitmapToleranceIn; overload ```pascal function FindBitmapToleranceIn(const BMP: Integer; var x, y: Integer; const SearchBox: TBox; const Tolerance: Integer): Boolean; overload; ``` Takes a TBox variable instead of x1, y1, x2 and y2 variables. ```{note} By Olly ``` Example: ```pascal Result := FindBitmapToleranceIn(BMP, x, y, Box, 20); ``` - - - ## FindDTMRotatedSE; overload ```pascal function FindDTMRotatedSE(const DTM: Integer; var x, y: Integer; SearchBox: TBox; sAngle, eAngle, aStep, aFound: Extended): Boolean; overload; ``` Takes a TBox variable instead of x1, y1, x2 and y2 variables. ```{note} By Olly ``` Example: ```pascal if (FindDTMRotatedSE(aDTM, x, y, Box, -Pi/4, Pi/4, Pi/60, aFound)) then WriteLn('Found the dtm!'); ``` - - - ## FindDTMRotatedAlternating: overload; ```pascal function FindDTMRotatedAlternating(DTM: Integer; var x, y: Integer; SearchBox: TBox; sAngle, eAngle, aStep, aFound: Extended): Boolean; overload; ``` Takes a TBox variable instead of x1, y1, x2 and y2 variables. ```{note} By Olly ``` Example: ```pascal if (FindDTMRotatedAlternating(DTM, x, y, Box, -Pi/4, Pi/4, Pi/60, aFound)) then WriteLn('Found the dtm!'); ``` - - - ## FindDTMRotated ```pascal function FindDTMRotated(const DTM: Integer; var x, y: Integer; const x1, y1, x2, y2: Integer; const sAngle, eAngle, aStep: Extended; out aFound: Extended): Boolean; ``` Searches for a rotated DTM, A legacy method commonly used in past SRL versions. ```{note} By Olly ``` Example: ```pascal if (FindDTMRotated(DTM, x, y, 100, 100, 400, 400, -Pi/4, Pi/4, Pi/60, aFound)) then WriteLn('Found the dtm!'); ``` - - - ## FindDTMRotated; overload ```pascal function FindDTMRotated(const DTM: Integer; var x, y: Integer; const SearchBox: TBox; const sAngle, eAngle, aStep: extended; out aFound: Extended): Boolean; overload; ``` Takes a TBox variable instead of x1, y1, x2 and y2 variables. ```{note} By Olly ``` Example: ```pascal if (FindDTMRotated(aDTM, x, y, Box, -Pi/4, Pi/4, Pi/60, aFound)) then WriteLn('found the dtm!'); ``` - - - ## FindDTMs; overload ```pascal function FindDTMs(const DTM: Integer; var TPA: TPointArray; const SearchBox: TBox): Boolean; overload; ``` Takes a TBox variable instead of x1, y1, x2 and y2 variables. ```{note} By Olly ``` Example: ```pascal FindDTMs(DTM, TPA, Box); WriteLn('Matches' + toString(TPA)); ``` - - - ## FindDTM; overload ```pascal function FindDTM(const DTM: Integer; var x, y: Integer; const SearchBox: TBox): Boolean; overload; ``` Takes a TBox variable instead of x1, y1, x2 and y2 variables. ```{note} By Olly ``` Example: ```pascal WriteLn(FindDTM(DTM, x, y, Box)); ``` - - - ## TPAFromText; overload ```pascal function TPAFromText(const Text, Font: string): TPointArray; overload; ``` Creates a TPA of the text without the need for the W and H params. ```{note} By Olly ``` Example: ```pascal TPA := TPAFromText('Hello world', StatChars); ``` - - - ## InRange; overload ```pascal function InRange(const Value, Min, Max: Extended): Boolean; overload; ``` Takes a extended variable instead of an integer variable. ```{note} By Olly ``` Example: ```pascal WriteLn(InRange(15.0, 10.0, 20.0)); ``` - - - ## Distance; overload ```pascal function Distance(const p1, p2: TPoint): Integer; overload; ``` Accepts two TPoints instead of x1, y1, x2 and y2 variables. ```{note} By Olly ``` Example: ```pascal WriteLn(Distance(Point(100, 100), Point(200, 200))); ```