FindColoredArea

From SCAR Divi Manual
Jump to: navigation, search

Definition

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

Availability

SCAR Divi 3.29 > Current

Description

This function searches for an area with the color specified by Color 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 color is found.

Example

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

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

See Also