function TForm1.findimg(pBmpMain,pBmpSub: TBitmap) :Boolean; var Pmain,psub,ptmp: PByteArray; x,y,z:Integer; b: boolean; begin result:=false; b:=false; for y:=0 to pBmpMain.Height-pBmpSub.Height do begin Pmain := pBmpMain.ScanLine[y]; psub := pBmpSub.ScanLine[0]; for x:=0 to pBmpMain.Width-pBmpSub.Width do begin b:=CompareMem(@Pmain[x*3],psub,sizeof(@psub)); if b then begin for z := 0 to pBmpSub.Height - 1 do begin Pmain := pBmpMain.ScanLine[y+z]; psub := pBmpSub.ScanLine[z]; b:=CompareMem(@Pmain[x*3],psub,pBmpSub.Width * 3); if not b then break; end; if b then Break; end; if b then break; end; if b then break; end; result:=b; end;
本文出自 “RZL_01的博客” 博客,请务必保留此出处http://rzl01.blog.51cto.com/3004337/1605263