波浪效果 :
const
amount=5;
inference=2;
style=0;
var
x,y,LL : integer;
Bmp : TBitMap;
P1,P2 : PByteArray;
b:integer;
fangle:real;
wavex:integer;
begin
Bmp :=TBitmap.Create;
Bmp.PixelFormat :=pf24Bit;
Bmp.Assign(Image1.Picture.Bitmap);
LL :=Bmp.Height;
wavex:=style;
if amount<>0 then
begin
fangle:=pi / 2 / amount;
for y := Bmp.height -1-(2*amount) downto amount do
begin
P1 := Bmp.ScanLine[y];
b:=0;
for x:=0 to Bmp.width-1 do
begin
P2 :=Bmp.scanline[y+amount+b];
P2[x*3]:=P1[x*3];
P2[x*3+1]:=P1[x*3+1];
P2[x*3+2]:=P1[x*3+2];
case wavex of
0: b:=amount*variant(sin(fangle*x));
1: b:=amount*variant(sin(fangle*x)*cos(fangle*x));
2: b:=amount*variant(sin(fangle*x)*sin(inference*fangle*x));
end;
end;
end;
end;
Image.Picture.Bitmap.Assign(Bmp)
Bmp.Free;
end;