1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
| unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
Button1 : TButton;
Button2 : TButton;
Image1 : TImage;
Image2 : TImage;
Memo1 : TMemo;
Memo2 : TMemo;
procedure Button1Click(Sender : TObject);
procedure Button2Click(Sender : TObject);
procedure FormCreate(Sender : TObject);
private
public
end;
var
Form1 : TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.FormCreate(Sender : TObject);
begin
image1.Picture.LoadFromFile('320x240x24_v3_96.bmp');
image2.Picture.LoadFromFile('320x240x24_v3_96.bmp'); //('240x180x24_v3_96.bmp');
end;
procedure TForm1.Button1Click(Sender : TObject);
var
B1, B2: TBitmap;
P1, P2: PByte;
w1, h1: integer;
begin
B1 := Image1.Picture.Bitmap; B2 := Image2.Picture.Bitmap;
P2 := B2.ScanLine[0];
for h1 := 0 to B1.Height-1 do // -B2.Height -1 do
begin
P1 := B1.ScanLine[h1];
// for w1 := 0 to B1.Width -B2.Width -1 do
// begin
if CompareMem(P1, P2, B2.Width *3) then
memo1.Append(Inttostr(h1)+' : OK')
else
memo1.Append(Inttostr(h1)+' : KC')
// end;
end;
end;
procedure TForm1.Button2Click(Sender : TObject);
var
B1, B2: TBitmap;
P1, P2: PByte;
w1, h1: integer;
begin
B1 := Image1.Picture.Bitmap; B2 := Image2.Picture.Bitmap;
//P2 := B2.ScanLine[0];
for h1 := 0 to B1.Height-1 do // -B2.Height -1 do
begin
P1 := B1.ScanLine[h1];
P2 := B2.ScanLine[h1];
//for w1 := 0 to B1.Width -B2.Width -1 do
//begin
if CompareMem(P1, P2, B2.Width *3) then
memo2.Append(Inttostr(h1)+' : OK')
else
memo2.Append(Inttostr(h1)+' : KC')
//end;
end;
end;
end. |
Partager