Einzelnen Beitrag anzeigen

Benutzerbild von 3_of_8
3_of_8

Registriert seit: 22. Mär 2005
Ort: Dingolfing
4.129 Beiträge
 
Turbo Delphi für Win32
 
#7

Re: Image und ImageList vergleichen

  Alt 18. Jun 2006, 22:55
Wie wärs damit:

Delphi-Quellcode:
function BitmapsEqual(bmp1, bmp2: TBitmap): Boolean;
var I, J: Integer;
begin
  if (bmp1 = nil) xor (bmp2 = nil) then
    Result:=True
  else
    Result:=False;
  if (bmp1 = nil) or (bmp2 = nil) then exit;

  if (bmp1.width <> bmp2.width) or (bmp1.height <> bmp2.height) then begin
    Result:=False;
    exit;
   end;

  Result:=False;

  for I:=0 to bmp1.width-1 do
    for J:=0 to bmp1.height-1 do
      if bmp1.canvas.pixels[I, J] <> bmp2.canvas.pixels[I, J] then exit;
  Result:=True;
end;
(Ungetestet)
Manuel Eberl
„The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it.“
- Terry Pratchett
  Mit Zitat antworten Zitat