1,184
社区成员
发帖
与我相关
我的任务
分享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;