来自:卷起千堆雪tyn, 时间:2001-12-24 22:10:00, ID:809383
YB老弟说我没有诚意,唉,那我就来点诚意,无私一把,给大家一点小小技巧----关于蚂蚁线
>以下程序在一个表单上放置一个Timer控件,设置Interval :=100;
>实现PhotoShop里的流动线效果.
>以下程序字节数<512,简练,高效;原来PhotoShop也不过如此~~
unit n;
interface
uses
Windows,Forms,Graphics,Classes,ExtCtrls;
type
TF=class(TForm)
m:TTimer;
procedure mTimer(Sender:TObject);
end;
var
F:TF;
a:Byte;
implementation
{$R *.DFM}
procedure c(X,Y:Integer;t:TCanvas);stdcall;
begin
a:=a shl 1;
if a =0 then a:=1;
if (a and 224)>0 then
t.Pixels[X,Y]:=clWhite
else
t.Pixels[X,Y]:=clBlack;
end;
procedure TF.mTimer(Sender:TObject);
begin
LineDDA(0,0,333,333,@c,LongInt(Canvas));
end;
end.
>运行之后,有没有看见象蚂蚁在爬呢?
最后祝所有的DFW象爬动的蚂蚁般幸福快乐 .