波纹:
procedure TMainForm.WaveWrap(XDIV,YDIV,RatioVal:Integer);
var
Tmp,bmp: Tbitmap;
i,j,XSrc,YSrc: Integer;
begin
if(YDiv=0)or(XDiv=0)then
Exit;
Tmp:=Tbitmap.create;
bmp:=Tbitmap.Create;
bmp.Assign(backbmp);
tmp.assign(backbmp);
for i:=0 to tmp.Width-1 do
for j:=0 to tmp.Height-1 do
begin
XSrc:=Round(i+RatioVal*Sin(j/YDiv));
YSrc:=Round(j+RatioVal*sin(i/XDiv));
if XSrc<0 then
XSrc:=Width-1-(-XSrc mod Width)
else if XSrc>=Width then
XSrc:=XSrc mod Width;
if YSrc<0 then
YSrc:=Height-1-(-YSrc mod Height)
else if YSrc>=Height then
YSrc:=YSrc mod(Height-1);
bmp.Canvas.Pixels[i,j]:=Tmp.Canvas.Pixels[XSrc,YSrc];
// end;
end;
childFORM.Image1.Picture.Assign(bmp);
bmp.Free;
Tmp.Free;
end;