雨滴效果
原理将暂存图形的最后一条扫描线依序搬移到可视位图的第一条到最后一条扫描线让此条扫描线在屏幕上留下它的轨迹接着再把暂存图形的倒数第二条扫描线依序搬移到可视位图的第一条到倒数第二条扫描线其余的扫描线依此类推
程序算法
procedure TFormButtonClick(Sender: TObject);
var
newbmp:TBitmap;
ijbmpheightbmpwidth:integer;
begin
newbmp:= TBitmapCreate;
newbmpWidth:=imageWidth;
newbmpHeight:=imageHeight;
bmpheight:=imageHeight;
bmpwidth:=imageWidth;
for i:=bmpheight downto do
for j:= to i do
begin
newbmpCanvasCopyRect(Rect(jbmpwidthj)
imageCanvas
Rect(ibmpwidthi));
formCanvasDraw(newbmp);
end;
newbmpfree;
end;
百叶窗效果
原理将放在暂存图形的数据分成若干组然后依次从第一组到最后一组搬移第一次每组各搬移第一条扫描线到可视位图的相应位置第二次搬移第二条扫描线接着搬移第三条第四条扫描线
程序算法
procedure TFormButtonClick(Sender: TObject);
var
newbmp:TBitmap;
ijbmpheightbmpwidth:integer;
xgroupxcount:integer;
begin
newbmp:= TBitmapCreate;
newbmpWidth:=imageWidth;
newbmpHeight:=imageHeight;
bmpheight:=imageHeight;
bmpwidth:=imageWidth;
xgroup:=;
xcount:=bmpheight div xgroup;
for i:= to xcount do
for j:= to xgroup do
begin
newbmpCanvasCopyRect(Rect
(xcount*j+ibmpwidthxcount*j+i)
imageCanvas
Rect(xcount*j+ibmpwidthxcount*j+i));
formCanvasDraw(newbmp);
end;
newbmpFree;
end;
积木效果
原理是雨滴效果的一种变化不同之处在于积木效果每次搬移的是一块图形而不只是一根扫描线
程序算法
procedure TFormButtonClick(Sender: TObject);
var
newbmp:TBitmap;
ijbmpheightbmpwidth:integer;
begin
newbmp:= TBitmapCreate;
newbmpWidth:=imageWidth;
newbmpHeight:=imageHeight;
bmpheight:=imageHeight;
bmpwidth:=imageWidth;
i:=bmpheight;
while i> do
begin
for j:= to i do
begin
newbmpCanvasCopyRect(Rect(jbmpwidthj)
imageCanvas
Rect(ibmpwidthi));
formCanvasDraw(newbmp);
end;
i:=i;
end;
newbmpfree;
end;
结束语
上述图形显示效果均已上机通过软件环境Delphi 硬件环境Pentium M兼容机使用效果很好
[] [] []