# Color¶

The Color include contains all Colorfinding routines.

Note

Remove?:
• FindDeformed
• DTMRotated
• GetColorsBox?

## FindDeformed¶

```function FindDeformed(var Xoff, Yoff: Integer; BMP, a, b, c, d: Integer): Boolean;
```

Finds Bitmap in Box a,b,c,d. Returns coords in ObjX and ObjY. Uses Deformed Bitmap. FindDeformed will gradually lower Tol and reduce Accuracy. Functon can cause severe Lag when using bitmaps bigger then 16 pixels. Works but Lags. Useful for MM-clicking. For ObjectFinding use FindObjectDeformed.

Note

by WT-Fakawi

Example:

## FindColorsPie¶

```function FindColorsPie(var Points: TPointArray; Color, Tol: Integer; StartD,
EndD, MinR, MaxR: Extended; x1, y1, x2, y2, Mx, My: Integer): Boolean;
```

Finds all Colors with tolerance in the Pie, defined by x1, y1, x2, y2, Mx, My, StartDegree, EndDegree, MinRadius and MaxRadius.

Note

by Wizzup?, edit by EvilChicken!

Example:

## DTMRotated¶

```function DTMRotated(DTM: Integer; var x, y: Integer; x1, y1, x2, y2: Integer): Boolean;
```

First looks for a DTM without rotation, then increases the amount of rotation around 0 gradually until it finds the DTM. A bit like the ProgressiveTol Bitmap Engines.

Note

by Yakman

Example:

## GetColorsBox¶

```function GetColorsBox(x1, y1, x2, y2: Integer; ClearSameColors: Boolean): TIntegerArray;
```

Returns an array of all colors within box ((x1, y1), (x2, y2)). If ClearSameColors is set to True, all duplicate colors will be deleted.

Note

by Rasta Magician

Example:

## PercentColorMMEx¶

```function PercentColorMMEx(Color, Tol, StartRadial, EndRadial, StartRadius, EndRadius: Integer): integer;
```

Returns the percentage of colour on the minimap section defined by StartRadial, EndRadial, StartRadius, and EndRadius.

Note

by Richard, and Nava2

Example:

## PercentColorMM¶

```function PercentColorMM(Color, Tol: Integer): Integer;
```

Returns the percent of a colour on the whole minimap.

Note

by Richard

Example:

## FindMMColorsTolerance¶

```function FindMMColorsTolerance(var Points: TPointArray; Color, Tol: Integer): Boolean;
```

Finds all colors within “Tol” tolerance in the minimap circle and if successful, returns a TPointArray containing them, sorted from MMCX, MMCY.

Note

by EvilChicken!

Example:

## ReturnTPAExceptColors¶

```function ReturnTPAExceptColors(cols, tols: TIntegerArray; area: TBox): TPointArray;
```

Returns a tpa of every point found in ‘area’ that DOES NOT a color in ‘cols’ with tolerance ‘tols’. Useful if you need a tpa of an object that is constantly changing color, but has a constant background color.

Note

Author: Coh3n Last Modified: Jan. 26th, 2012 by Coh3n

Example:

```iTPA := InverseColors([4410947, 5003083], [10, 10], IntToBox(MCX1, MCY1, MCX2, MCY2));
```

## GetColorArrayInfo¶

```function GetColorArrayInfo(C: TIntegerArray; var BestColors, Tolerances: TIntegerArray; Speed2Mods: TExtendedArray; var RGB: array of TIntegerArray; var HSL, XYZ: array of TExtendedArray): array of array of TExtendedArray;
```
Takes an array of colours and outputs a multitude of information
• BestColors
• An array of the best color to find per CTS Speed, the array index is relative to the CTS - 1. AKA BestColors[2] returns the best color for ColorToleranceSpeed 3.
• Tolerances
• An array of the necessary tolerance to find all of the colours with array index is the CTS. Tolerances[1] = CTS 1.
• Speed2Mods
• [0]is Hue modifier, [1] is Saturation. RGB, HSL, XYZ: Arrays which hold the RGB, HSL, and XYZ values respectively.
• The Result
• The result array is divided like so
• Result[CTS][Div][MMA]

• CTS
• The colour tolerance speed - 1. 0 and 1 are combined since they both use RGB.
• Div
• The division, for exampe HSL, H is index 0, S is index 1, and L is index 2.
• MMA
• The last values are the Minimum, Maximum, and average of the colors.

Note

by Nava2

Example:

## GetBestColor¶

```function GetBestColor(Colors: TIntegerArray; CTS: Integer; var Tol: Integer; var Speed2Modifiers: TExtendedArray): Integer;
```

Gets the best colour to find as well as the tolerance and modifiers based on which CTS you input.

Note

by Nava2

Example:

## CreateAutoColorInfo¶

```function CreateAutoColorInfo(Colors: TIntegerArray): TAutoColorInfo;
```

Creates a TAutoColorInfo from the inputted array of colors.

Note

by Nava2

Example:

## SRL_GetBlackBackground¶

```function SRL_GetBlackBackground: integer;
```

Autocolours the black background colour. Returns -1 if not found.

Note

Author: ZephyrsFury Last Modified: Unknown/March 08, 2012

Example:

```blackColour := SRL_GetBlackBackground;
```

## PercentBlackMM¶

```function PercentBlackMM: integer;
```

Returns the percentage of the minimap which is black.

Note

Author: NaumanAkhlaQ Last Modified: Unknown/March 08, 2012

Example:

```blackPercent := PercentBlackMM;
```