A
afeisky
Unregistered / Unconfirmed
GUEST, unregistred user!
var Bitmap1, Bitmap2, Bitmap3: TBitmap;
Image1Loaded, Image2Loaded: Boolean;
procedure TForm1.FormCreate(Sender: TObject);
begin
bitmap1 := Graphics.TBitmap.Create;
bitmap2 := Graphics.TBitmap.Create;
bitmap3 := Graphics.TBitmap.Create;
bitmap1.PixelFormat := pf8bit; //?(1) pf8bit是什么意思?
bitmap2.PixelFormat := pf8bit;
bitmap3.PixelFormat := pf8bit;
try
bitmap1.LoadFromFile('factory.bmp');
bitmap2.LoadFromFile('handshak.bmp');
Image1Loaded := true;
Image2Loaded := true;
bitmap3.Palette := bitmap1.Palette; //? (2) Palette是什么来的?
bitmap3.Height := bitmap1.Height;
bitmap3.Width := bitmap1.Width;
except
Image1Loaded := false;
Image2Loaded := false;
end;
Form1.DoubleBuffered:=True;
end;
procedure TForm1.SlideFromLeft1Click(Sender: TObject);
var
Current: PByteArray;
Next: PByteArray;
ToDisplay: PByteArray;
i, y, j, z: Integer;
begin
if not (Image1Loaded) then
ShowMessage('Bitmap1 not loaded');
if not (Image2Loaded) then
ShowMessage('Bitmap2 not loaded');
if((Image1Loaded) and (Image2Loaded)) then
begin
for i := 0 to bitmap1.Width - 1 do
begin
for y := 0 to bitmap1.Height -1 do
begin //?(3) 下面这段干什么用?
Current := bitmap1.ScanLine[y];
Next := bitmap2.ScanLine[y];
ToDisplay := bitmap3.ScanLine[y];
for z := 0 to i - 1 do
ToDisplay[z] := Next[z];
for j := i to bitmap1.Width - 1 do
ToDisplay[j] := Current[j];
end;
Image1.Canvas.Draw(0,0,bitmap3); //??(4) 什么意思,直接用没效果。
Application.ProcessMessages(); //??(5) 不用则没有效果。
end;
end;
end;
程序测试是从左到右画BMP图!!!
但不知道各个语句的意思????请高手解析一下。
Image1Loaded, Image2Loaded: Boolean;
procedure TForm1.FormCreate(Sender: TObject);
begin
bitmap1 := Graphics.TBitmap.Create;
bitmap2 := Graphics.TBitmap.Create;
bitmap3 := Graphics.TBitmap.Create;
bitmap1.PixelFormat := pf8bit; //?(1) pf8bit是什么意思?
bitmap2.PixelFormat := pf8bit;
bitmap3.PixelFormat := pf8bit;
try
bitmap1.LoadFromFile('factory.bmp');
bitmap2.LoadFromFile('handshak.bmp');
Image1Loaded := true;
Image2Loaded := true;
bitmap3.Palette := bitmap1.Palette; //? (2) Palette是什么来的?
bitmap3.Height := bitmap1.Height;
bitmap3.Width := bitmap1.Width;
except
Image1Loaded := false;
Image2Loaded := false;
end;
Form1.DoubleBuffered:=True;
end;
procedure TForm1.SlideFromLeft1Click(Sender: TObject);
var
Current: PByteArray;
Next: PByteArray;
ToDisplay: PByteArray;
i, y, j, z: Integer;
begin
if not (Image1Loaded) then
ShowMessage('Bitmap1 not loaded');
if not (Image2Loaded) then
ShowMessage('Bitmap2 not loaded');
if((Image1Loaded) and (Image2Loaded)) then
begin
for i := 0 to bitmap1.Width - 1 do
begin
for y := 0 to bitmap1.Height -1 do
begin //?(3) 下面这段干什么用?
Current := bitmap1.ScanLine[y];
Next := bitmap2.ScanLine[y];
ToDisplay := bitmap3.ScanLine[y];
for z := 0 to i - 1 do
ToDisplay[z] := Next[z];
for j := i to bitmap1.Width - 1 do
ToDisplay[j] := Current[j];
end;
Image1.Canvas.Draw(0,0,bitmap3); //??(4) 什么意思,直接用没效果。
Application.ProcessMessages(); //??(5) 不用则没有效果。
end;
end;
end;
程序测试是从左到右画BMP图!!!
但不知道各个语句的意思????请高手解析一下。