请教图像显示“余辉”效果

xlbian 2008-11-05 12:49:08
能否实现图像的“余辉”效果?
用一条扫描线从左到右扫描图像,扫描线处的图案显示出来,并且亮度最高,当扫描线离开时,亮度逐渐降低,直至消失。
...全文
215 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
xlbian 2008-11-07
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 etomahawk 的回复:]
基本的原理我已经告诉你了,至于实现圆周扫描,属于数学问题了(就是在混合的时候,对于像素点的判断),你自己研究研究吧。

我有时间的话再帮你写。
[/Quote]

好的,谢谢。我担心速度太慢!
etomahawk 2008-11-07
  • 打赏
  • 举报
回复
基本的原理我已经告诉你了,至于实现圆周扫描,属于数学问题了(就是在混合的时候,对于像素点的判断),你自己研究研究吧。

我有时间的话再帮你写。
xlbian 2008-11-07
  • 打赏
  • 举报
回复
好的,谢谢。我担心圆周处理后速度太慢!
mdejtod 2008-11-06
  • 打赏
  • 举报
回复
mark
zhangxiaommmm 2008-11-06
  • 打赏
  • 举报
回复
太佩服你了!!
xlbian 2008-11-06
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 etomahawk 的回复:]
没人愿意写代码,我就写点,顺便加到我的图像处理库中。

基本原理很简单,就是使用了图像的Alpha混合原理。

到我的资源中去下载:http://download.csdn.net/source/754773

关键部分代码:

Delphi(Pascal) codeprocedure TFadeThread.DrawImage;
var
pSrcLine: PByteArray;
pDstLine: PByteArray;
nAlpha : BYTE;
nStep : BYTE;
nTmp : BYTE;
nRow, nCol: Integer;
begin
nStep:= 2…
[/Quote]

如果是圆周扫描,该如何实现?
etomahawk 2008-11-06
  • 打赏
  • 举报
回复
没人愿意写代码,我就写点,顺便加到我的图像处理库中。

基本原理很简单,就是使用了图像的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;

1,184

社区成员

发帖
与我相关
我的任务
社区描述
Delphi GAME,图形处理/多媒体
社区管理员
  • GAME,图形处理/多媒体社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧