FindColoredArea

From SCAR Divi Manual
Revision as of 13:28, 15 November 2011 by Freddy (talk | contribs) (Created page with "==Definition== <source lang="scar" lines="false"> function FindColoredArea(out x, y: Integer; const Color: Integer; const xs, ys, xe, ye, MinPix: Integer): Boolean; </source> ==...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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 color 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 found color in (x, y). The search will stop after the first color was 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