用下面的方法你可以实现 将一幅位图(天鹅)显示在另一幅(水面)的奇妙效果!
Blend,Do you know?
var
i, j: Integer;
BackPoint, ForePoint: pByteArray;
begin
for i := 0 to FBackGround.Height - 1 do
begin
BackPoint := FBackGround.ScanLine;
ForePoint := FForeGround.ScanLine;
for j := 0 to (3 * FBackGround.Width) - 1 do
ForePoint[j] := ForePoint[j] + Transparency * (BackPoint[j] - ForePoint[j]) div 100;
end;
end;
{水印效果
参数:WaterMark 水印图片
Source 待加水印的图片
Left 水印位置
Top 水印位置
AlphaValue 透明度
TransColor 水印图片透明色
}
procedure BmpWaterMark(WaterMark,Source:TBitmap;Left,Top,AlphaValue:Integer;TransColor:TColor=0);
var
x,y:Integer;
R,Rs,Rw,G,Gs,Gw,B,Bs,Bw:Integer;
Wcl,Scl:TColor;
Begin
{水印}
For x:=0 to WaterMark.Width-1 do
Begin
For y:=0 to WaterMark.Height-1 do
Begin
Wcl:=WaterMark.Canvas.Pixels[x,y];
IF (TransColor<>0)and(Wcl=TransColor) then Continue;