请教图像显示“余辉”效果 能否实现图像的“余辉”效果?用一条扫描线从左到右扫描图像,扫描线处的图案显示出来,并且亮度最高,当扫描线离开时,亮度逐渐降低,直至消失。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 没人愿意写代码,我就写点,顺便加到我的图像处理库中。基本原理很简单,就是使用了图像的Alpha混合原理。到我的资源中去下载:http://download.csdn.net/source/754773关键部分代码:procedure TFadeThread.DrawImage;var pSrcLine: PByteArray; pDstLine: PByteArray; nAlpha : BYTE; nStep : BYTE; nTmp : BYTE; nRow, nCol: Integer;begin nStep:= 255 div FadeWidth; // Clear old images FBufBmp.Canvas.Pen.Color := clBlack; FBufBmp.Canvas.Brush.Color:= clBlack; FBufBmp.Canvas.Rectangle(0, 0, FBufBmp.Width, FBufBmp.Height); for nRow:= 0 to FBufBmp.Height - 1 do begin pSrcLine:= FBkBmp.ScanLine[nRow]; pDstLine:= FBufBmp.ScanLine[nRow]; nAlpha:= 0; for nCol:= FCurCol to FBufBmp.Width - 1 do begin inc(nAlpha); if (nAlpha > FadeWidth) then break; if nCol < 0 then continue; nTmp:= nStep * nAlpha; pDstLine[nCol * 3 ]:= nTmp * pSrcLine[nCol * 3 ] div 255; pDstLine[nCol * 3 + 1]:= nTmp * pSrcLine[nCol * 3 + 1] div 255; pDstLine[nCol * 3 + 2]:= nTmp * pSrcLine[nCol * 3 + 2] div 255; end; end; inc(FCurCol); if (FCurCol > FBufBmp.Width - 1) then FCurCol:= -FadeWidth;end; 保存数据之后窗体自动关闭了??? 讨论:判断函数返回值用 not 呢还是用 = false 呢? 一个关于控制打印机直接打印的问题...大家帮忙看看... 再来100 分求F1BOOK6的几个简单的问题?请F1BOOK6的高手进来。 有谁用过FastReport工具吗?是否能够把报表导为EXCEL文件。 Delphi中预想不到的代码 求救,VC -> Delphi 只有高手才能解决这个问题了。。焦急等待中。。。。 请问QUICKREPORT怎么用呀 欢迎参加需求调查! 如何设置image控件背景颜色 DELHI使用SPCOMM接收串口数据的问题
procedure TFadeThread.DrawImage;
var
pSrcLine: PByteArray;
pDstLine: PByteArray;
nAlpha : BYTE;
nStep : BYTE;
nTmp : BYTE;
nRow, nCol: Integer;
begin
nStep:= 255 div FadeWidth; // Clear old images
FBufBmp.Canvas.Pen.Color := clBlack;
FBufBmp.Canvas.Brush.Color:= clBlack;
FBufBmp.Canvas.Rectangle(0, 0, FBufBmp.Width, FBufBmp.Height); for nRow:= 0 to FBufBmp.Height - 1 do
begin
pSrcLine:= FBkBmp.ScanLine[nRow];
pDstLine:= FBufBmp.ScanLine[nRow]; nAlpha:= 0;
for nCol:= FCurCol to FBufBmp.Width - 1 do
begin
inc(nAlpha);
if (nAlpha > FadeWidth) then break; if nCol < 0 then continue; nTmp:= nStep * nAlpha;
pDstLine[nCol * 3 ]:= nTmp * pSrcLine[nCol * 3 ] div 255;
pDstLine[nCol * 3 + 1]:= nTmp * pSrcLine[nCol * 3 + 1] div 255;
pDstLine[nCol * 3 + 2]:= nTmp * pSrcLine[nCol * 3 + 2] div 255;
end;
end; inc(FCurCol); if (FCurCol > FBufBmp.Width - 1) then FCurCol:= -FadeWidth;
end;