Difference between revisions of "FindColoredArea"
From SCAR Divi Manual
(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> ==...") |
(→Description) |
||
Line 8: | Line 8: | ||
==Description== | ==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 | + | 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 pixel that was first found in the area in ('''x''', '''y'''). The search will stop after the first color was found. |
==Example== | ==Example== |
Revision as of 14:30, 15 November 2011
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 pixel that was first found in the area 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.