Cita:
Empezado por lag_0
si era por eso, me hace ir muuuuuuuuuuuchoooooooo más lento el tema
|
No entiendo porque.
Cita:
Empezado por lag_0
se os ocurre algún metodo para optimizar más el codigo?
|
Tengo algunas ideas, pero estaría bien que dijeras lo que intentas hacer. A simple vista te puedo decir que el método que usas para comparar las imágenes usando la propiedad pixels es MUY ineficiente. Aquí te dejo una alternativa, aunque seguro que se puede mejorar.
Código Delphi
[-]
function SonIguales(Bitmap1, Bitmap2: TBitmap): Boolean;
var
i,j: integer;
begin
Result:= FALSE;
if (Bitmap1.Width = Bitmap2.Width) and (Bitmap1.Height = Bitmap2.Height) and
(Bitmap1.PixelFormat = Bitmap2.PixelFormat) then
begin
case Bitmap1.PixelFormat of
pf16bit: j:= (Bitmap1.Width*2) -1;
pf24bit: j:= (Bitmap1.Width*3) -1;
pf32bit: j:= (Bitmap1.Width*4) -1;
else j:= Bitmap1.Width -1;
end;
for i:= 0 to Bitmap1.Height - 1 do
if not CompareMem(Bitmap1.ScanLine[i],Bitmap2.ScanLine[i],j) then
Exit;
Result:= TRUE;
end;
end;