将 这种 删掉 某一颜色 的Bitmap 画到 已经 画好 的 背景上,是不是 就有透明效果了??
解决方案 »
- Delphi中怎么换桌面(实时的+可用非BMP图片)
- 请问哪位有或做过心电图控件?
- 很急,希望能尽快有人答复我!不是很复杂的问题
- 如何获取filter筛选后的数据集的记录
- 用Query Analyzer可以登录到另一个机器SQL SERVER,SA是没能密码的,但用Enterprise Manager就不行??
- 各位大哥帮个忙~~~~~~~~~~~~~~~关于创建一个组件.
- 如何开发FTPServer?请各位大虾多多帮忙!
- 关于IdTCPServer的问题
- VB中的变量类型Long是不是就是Delphi中的Interger?VB中的变量类型Integer是不是就是Delphi中的shortint?
- 數據改變精度!為什麼????
- 求助:dephi中怎么用ado动态建表
- 急呀!!!请高手指点!
TransR, TransG, TransB: Integer);
var
X, Y: Integer;
PB, PF: PbyteArray;
R1, R2, G1, G2, B1, B2: Integer;
begin
BkGround.PixelFormat := pf24bit;
FrGround.PixelFormat := pf24bit;
for Y := Top to BkGround.Height - 1 do
begin
if Y - Top > FrGround.Height - 1 then
Break;
PB := BkGround.ScanLine[Y];
PF := FrGround.ScanLine[Y - Top];
for X := Left to BkGround.Width - 1 do
begin
if X - Left > FrGround.Width - 1 then
Continue;
B1 := PB[X * 3];
G1 := PB[X * 3 + 1];
R1 := PB[X * 3 + 2];
B2 := PF[(X - left) * 3];
G2 := PF[(X - left) * 3 + 1];
R2 := PF[(X - left) * 3 + 2];
if (B2 = TransB) and (G2 = TransG) and (R2 = TransR) then
Continue;
PB[X * 3] := (B2 * Alpha + B1 * (255 - Alpha)) div 255;
PB[X * 3 + 1] := (G2 * Alpha + G1 * (255 - Alpha)) div 255;
PB[X * 3 + 2] := (R2 * Alpha + R1 * (255 - Alpha)) div 255;
end;
end;
end;
var bit:TBitmap;
begin
bit:=TBitmap.Create;
try
if OpenDialog1.Execute then
bit.LoadFromFile(openDialog1.FileName);
bit.Transparent:=true;
bit.TransparentColor:=clBlack;//设黑色为透明色
Image1.Canvas.Draw(10,10,bit);
finally
bit.Free;
end;
end;