FindColoredAreaTolerance

From SCAR Divi Manual
Jump to: navigation, search

Definition

function FindColoredAreaTolerance(out x, y: Integer; const Color: Integer; const xs, ys, xe, ye, MinPix, Tol: Integer): Boolean;

Availability

SCAR Divi 3.00 > Current

Description

This function searches for an area with the color specified by Color within a tolerance range specified by Tol, with a mimimum number of pixels specified in MinPix, inside of a given search area specified by xs, ys, xe, ye using a scan-line pattern. The search area is given as a set of upper-left (xs, ys) and lower-right (xe, ye) coordinates which are specified relative to the selected client window. The function returns false if the color was not found, if it was it returns true and the coordinates of the pixel that was first found in the area in (x, y). The search will stop after the first area is found. The active tolerance algorithm can be changed using the ColorToleranceSpeed function.

Example

var
  w, h: Integer;
  x, y: Integer;

begin
  GetClientDimensions(w, h);
  if FindColoredAreaTolerance(x, y, 0, 0, 0, w - 1, h - 1, 20, 5) then
    WriteLn('Found colored area of at least 20 pixels at ' + IntToStr(x) + ', ' + IntToStr(y));
end.

See Also