Jump to content
Janilabo

CountUnmatchedColors

Recommended Posts

Counts unmatched colors in area (XS, YS, XE, YE). Example included.

 

CountUnmatchedColors

[scar]function CountUnmatchedColors(color, XS, YS, XE, YE: Integer): Integer;

begin

if (XS > XE) or (YS > YE) then

Exit;

Result := ((((XE - XS) + 1) * ((YE - YS) + 1)) - CountColor(color, XS, YS, XE, YE));

end;

 

var

W, H: Integer;

 

begin

SetDesktopAsClient;

GetClientDimensions(W, H);

WriteLn('Count of white colors in screen: ' + IntToStr(CountColor(16777215, 0, 0, (W - 1), (H - 1))));

WriteLn('Count of other colors in screen: ' + IntToStr(CountUnmatchedColors(16777215, 0, 0, (W - 1), (H - 1))));

end.[/scar]

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...