您现在的位置:首页 >> 图形媒体 >> 图形媒体 >> 内容

比较两个位图是否相同

时间:2011/9/3 15:03:29 点击:

  核心提示:function IsBmpSame(bmp1,bmp2: TBitmap): Boolean;var i,j: Integer; ScanLine1,ScanLine2: PByteArray; C...
function IsBmpSame(bmp1,bmp2: TBitmap): Boolean;
var
  i,j: Integer;
  ScanLine1,ScanLine2: PByteArray;
  Count: Integer;
begin
  Result := (bmp1.Height = bmp2.Height) and
            (bmp1.Width = bmp2.Width) and
            (bmp1.PixelFormat = bmp2.PixelFormat);
  if Result then
  begin
    i := Integer(bmp1.PixelFormat);
    if i < 4 then
      i := 4
    else if i = 4 then
      inc(i);
    Count := (i - 3) * bmp1.Width - 1;

    for i:=0 to bmp1.Height-1 do
    begin
      ScanLine1 := bmp1.ScanLine[i];
      ScanLine2 := bmp2.ScanLine[i];
      for j := 0 to Count do
        if ScanLine1[j] <> ScanLine2[j] then
        begin
          Result := False;
          Exit;
        end;
    end;
  end;
end;

作者:网络 来源:转载
共有评论 0相关评论
发表我的评论
  • 大名:
  • 内容:
本类推荐
  • 没有
本类固顶
  • 没有
  • 盒子文章(www.2ccc.com) © 2024 版权所有 All Rights Reserved.
  • 沪ICP备05001939号