//例子程序
//在Form1上放2个Image,装入大小一样的bmp图像
procedure TForm1.Button1Click(Sender: TObject);
var
i,j,k : Integer;
bmp : TBitmap;
p,p1,p2 : PByteArray;
begin
bmp := TBitmap.Create;
bmp.Width := image1.Width;
bmp.Height := image1.Height;
bmp.PixelFormat := pf24Bit;
image1.Picture.Bitmap.PixelFormat := pf24Bit;
image2.Picture.Bitmap.PixelFormat := pf24Bit;
try
for i := 0 to 255 do
begin
for j := 0 to bmp.Height -1 do
begin
p := bmp.ScanLine[j];
p1 := image1.Picture.Bitmap.ScanLine[j];
p2 := image2.Picture.Bitmap.ScanLine[j];
for k := 0 to bmp.Width * 3 -1 do
p[k] := p1[k] * i div 256 + p2[k] * (256-i) div 256;
end;
Canvas.Draw(0,0,bmp);
sleep(50);
end;
finally
bmp.Free;
end;
end;