返璞归真3:实现photoshop里的流动线效果! (1分)

  • 主题发起人 主题发起人 卷起千堆雪tyn
  • 开始时间 开始时间

卷起千堆雪tyn

Unregistered / Unconfirmed
GUEST, unregistred user!

Timer1.Interval = 200;

var
Form1: TForm1;
Counter :Byte;

implementation

{$R *.DFM}

procedure MovingDots(X,Y: Integer; TheCanvas: TCanvas); stdcall;
begin
Counter := Counter shl 1; // Shift the bit left one
if Counter = 0 then Counter := 1; // If it shifts off left, reset it
if (Counter and 224) > 0 then // Are any of the left 3 bits set?
TheCanvas.Pixels[X,Y] :=clBtnFace // Erase the pixel
else
TheCanvas.Pixels[X,Y] :=clBlack; // Draw the pixel
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
LineDDA(30,30,200,30,@MovingDots,LongInt(Canvas));
LineDDA(200,30,200,150,@MovingDots,LongInt(Canvas));
LineDDA(200,150,30,150,@MovingDots,LongInt(Canvas));
LineDDA(30,150,30,30,@MovingDots,LongInt(Canvas));
end;
 
看不懂*_^
 
The following come from the Windows SDK :

The LineDDA function determines which pixels should be highlighted
for a line defined by the specified starting and ending points.
BOOL LineDDA(

int nXStart, // x-coordinate of line's starting point
int nYStart, // y-coordinate of line's starting point
int nXEnd, // x-coordinate of line's ending point
int nYEnd, // y-coordinate of line's ending point
LINEDDAPROC lpLineFunc, // address of application-defined callback function
LPARAM lpData // address of application-defined data
);
The LineDDA function passes the coordinates for each point along the line,
except for the line's ending point, to the application-defined callback function.
In addition to passing the coordinates of a point, this function passes
any existing application-defined data.
The coordinates passed to the callback function match pixels on a video display
only if the default transformations and mapping modes are used.
 
原来是搞这个的,不复杂啊。你的程序好像还会把底图覆盖
 
卷兄做好事还需要“勇气”吗?
 
请老千继续........
 
非常好,再加些注释就更好了
 
注释已加,谢谢提示.
 
真的很好,跟贴
 
洋文不好!
 
偶的中文不如E文。。。。。。。。
 
不管如何,还是期待最后的结果。。。。
 
i like
努力把!
 
也增加了我的勇气
谢谢
 
能说一下 《返璞归真1、2》的地址吗?
3Q~
 
here :

http://www.delphibbs.com/delphibbs/dispq.asp?lid=929672
http://www.delphibbs.com/delphibbs/dispq.asp?lid=929636
 
to 卷起千堆雪tyn: 3Q ~

弃恶从善

支持! :)
 
后退
顶部