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

function GetClientBounds(): TBox;

Returns the clients bounds.

Note

by Olly

Example:

b := GetClientBounds();

GetColor; overload

function GetColor(const p: TPoint): Integer; overload;

Takes a TPoint variable instead of x, y variables.

Note

by Olly

Example:

p := Point(350, 200);
WriteLn(GetColor(p));

GetColors; overload

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:

Colors := GetColors(TPA, True);

FindColor; overload

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:

FindColor(x, y, clRed, Box);

findColorTolerance; overload

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:

FindColorTolerance(x, y, 255, Box, 10);

FindColors; overload

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:

WriteLn(FindColors(TPA, 255, Box));

FindColorsTolerance; overload

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:

WriteLn(FindColorsTolerance(TPA, 255, Box, 10));

FindColorSpiral; overload

function FindColorSpiral(var x, y: Integer; Color: Integer; SearchBox: TBox): Boolean; overload;

Takes a TBox variable instead of x1, y1, x2 and y2 variables.

Note

by Olly

Example:

WriteLn(FindColorSpiral(x, y, 255, Box));

FindColorSpiralTolerance; overload

function FindColorSpiralTolerance(var x, y: Integer; Color: Integer; SearchBox: TBox; Tol: Integer): Boolean; overload;

Takes a TBox variable instead of x1, y1, x2 and y2 variables.

Note

by Coh3n

Example:

WriteLn(FindColorSpiralTolerance(x, y, 255, Box));

FindColorsSpiralTolerance: overload;

function FindColorsSpiralTolerance(var x, y: Integer; var Points: TPointArray; Color: Integer; SearchBox: TBox; Tolerance: Integer): boolean; overload;

Takes a TBox variable instead of x1, y1, x2 and y2 variables.

Note

by Olly

Example:

FindColorsSpiralTolerance(x, y, TPA, clWhite, mainScreen.GetBounds, 10);

CountColor; overload

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:

WriteLn(CountColor(clRed, Box));

CountColorTolerance: overload;

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:

WriteLn(CountColorTolerance(clRed, 10, Box));

FreeDTMs

procedure FreeDTMs(const DTMs: TIntegerArray);

Free’s an array of DTMs.

Note

by Olly

Example:

FreeDTMs([dtm1, dtm2]);

FreeBitmaps

procedure FreeBitmaps(const Bitmaps: TIntegerArray);

Free’s an array of bitmaps.

Note

by Olly

Example:

FreeBitmaps([bmp1, bmp2]);

GetBitmapName

function GetBitmapName(const Index: Integer): String;

Returns the name of the bitmap stored in ‘index’.

Note

by Olly

Example:

WriteLn(GetBitmapName(BMP));

GetDTMName

function GetDTMName(const Index: Integer): String;

Returns the name of the dtm stored in ‘index’.

Note

by Olly

Example:

WriteLn(GetDTMName(DTM));

BitmapFromClient; overload

function BitmapFromClient(const SearchBox: TBox): Integer; overload;

Takes a TBox variable instead of x1, y1, x2 and y2 variables.

Note

by Olly

Example:

BMP := BitmapFromClient(Box);

FindBitmapIn; overload

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:

Result := FindBitmap(bmp, x, y, Box);

FindBitmapToleranceIn; overload

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:

Result := FindBitmapToleranceIn(BMP, x, y, Box, 20);

FindBitmapTolerance

function FindBitmapTolerance(const BMP: Integer; var x, y: Integer; const Tolerance: Integer): Boolean;

Searches the whole client for a bitmap with tolerance.

Note

by Olly

Example:

WriteLn(FindBitmapTolerance(bmp, x, y, 50));

FindBitmapMaskTolerance; overload

function FindBitmapMaskTolerance(Mask: Integer; var p: TPoint; SearchBox: TBox; Tol, ContourTol: Integer): Boolean; overload;

Takes a TBox variable instead of x1, y1, x2 and y2 variables.

Note

by Coh3n

Example:

Result := FindBitmapMaskTolerance(s, p, Box, 30, 30);

FindDeformedBitmapToleranceIn; overload

function FindDeformedBitmapToleranceIn(const BMP: Integer; var x, y: Integer; SearchBox: TBox; Tolerance: Integer; Range: Integer; AllowPartialAccuracy: Boolean; var Accuracy: Extended): Boolean; overload;

Takes a TBox variable instead of x1, y1, x2 and y2 variables.

Note

by Olly

Example:

if (FindDeformedBitmapToleranceIn(BMP, x, y, Box, 10, 0, true, acc)) then
  WriteLn('We found the bitmap at accuracy: ' floatToStr(acc));

FindDTMRotatedSE; overload

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:

if (FindDTMRotatedSE(aDTM, x, y, Box, -Pi/4, Pi/4, Pi/60, aFound)) then
  WriteLn('Found the dtm!');

FindDTMRotatedAlternating: overload;

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:

if (FindDTMRotatedAlternating(DTM, x, y, Box, -Pi/4, Pi/4, Pi/60, aFound)) then
  WriteLn('Found the dtm!');

FindDTMRotated

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:

if (FindDTMRotated(DTM, x, y, 100, 100, 400, 400, -Pi/4, Pi/4, Pi/60, aFound)) then
  WriteLn('Found the dtm!');

FindDTMRotated; overload

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:

if (FindDTMRotated(aDTM, x, y, Box, -Pi/4, Pi/4, Pi/60, aFound)) then
  WriteLn('found the dtm!');

FindDTMs; overload

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:

FindDTMs(DTM, TPA, Box);
WriteLn('Matches' + toString(TPA));

FindDTM; overload

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:

WriteLn(FindDTM(DTM, x, y, Box));

TPAFromText; overload

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:

TPA := TPAFromText('Hello world', StatChars);

Replicate; overload

function Replicate(const Str: String; const Times: Integer): String; overload;

Used to replicate any string, instead of chars.

Note

by Zyt3x

Example:

WriteLn(Replicate('SRL', 10));

InRange; overload

function InRange(const Value, Min, Max: Extended): Boolean; overload;

Takes a extended variable instead of an integer variable.

Note

by Olly

Example:

WriteLn(InRange(15.0, 10.0, 20.0));

Distance; overload

function Distance(const p1, p2: TPoint): Integer; overload;

Accepts two TPoints instead of x1, y1, x2 and y2 variables.

Note

by Olly

Example:

WriteLn(Distance(Point(100, 100), Point(200, 200)));