SimilarBitmapsEx

From SCAR Divi Manual
Jump to: navigation, search

Definition

function SimilarBitmapsEx(const Bmp1, Bmp2, Tol: Integer; out Diff: TPointArray): Boolean;

Availability

SCAR Divi 3.30 > Current

Description

This function returns true if all pixels of 2 given bitmaps specified by Bmp1 and Bmp2 are within the tolerance range of each other specified by Tol. This is determined using the active tolerance algorithm which can be changed with ColorToleranceSpeed. If the functions returns false, it will fill up the TPointArray TPA with the coordinates of all pixels that did not match in case that the bitmaps were of equal size.

Example

var
  b1, b2: Integer;
  TPA: TPointArray;

begin
  b1 := BitmapFromString(100, 100, '');
  b2 := BitmapFromString(100, 100, '');
  if not SimilarBitmapsEx(b1, b2, 5, TPA) then
    WriteLn(TPAToStr(TPA));
  FastSetPixel(b1, 5, 5, 255);
  if not SimilarBitmapsEx(b1, b2, 5, TPA) then
    WriteLn(TPAToStr(TPA));
end.

Output:

(5,5)

See Also