如何将一仅含文字的小图叠加到另一图片上并呈透明,也就是大图片的图像透过小图片的没有文字的部分显示出来?小图片中的文字是经过特殊加工的,不能通过Textout来输出
解决方案 »
- 菜鸟问题,delphi的webbrowser里的函数怎么用啊
- 如何默认DSPACK的分辨率
- 请教一个查询问题
- 如何实现只能通过点击按钮来关闭窗体?
- 如何用ADOQuery访问SQL2000里的存储过程,而且存储过程的参数类型是输入输出都有??
- FastReport中如何设置TFrPictureView的KeepAsPect为False,,及画斜线问题。
- 生产菜单的时候,如何去掉delphi自动创建的用于快捷操作字母
- 请问: Turbo系列的Pascal编译器, 哪一个能写DLL ?
- 在安装sql 客户端的电脑中可以使用我的程序进行联接远程联接,但没有安装的就不行,请问 怎么回事?谢谢
- 谁能发一个好的TREEVIEW控件给我,我给他20分。[email protected]
- 急!急!怎么样在DELPHI中播放DVD文件??
- 这样的情况怎么填充空格?解决即揭贴!
procedure DrawTransparent(var sBmp: TBitMap; dBmp: TBitMap; PosX, PosY:
Integer);
type
PRGBTripleArray = ^TRGBTripleArray;
TRGBTripleArray = array[0..32767] of TRGBTriple;
function GetSLCOlor(pRGB: TRGBTriple): TColor;
begin
Result := RGB(pRGB.rgbtRed, pRGB.rgbtGreen, pRGB.rgbtBlue);
end;
var
b, p: PRGBTripleArray;
x, y: Integer;
BaseColor: TColor;
begin
p := dBmp.scanline[0];
BaseCOlor := GetSLCOlor(p[0]);
for y := 0 to dBmp.Height - 1 do
begin
p := dBmp.scanline[y];
b := sBmp.ScanLine[y + PosY];
for x := 0 to (dBmp.Width - 1) do
begin
if GetSLCOlor(p[x]) <> BaseCOlor then
b[x + PosX] := p[x];
end;
end;end;
procedure TForm1.Button1Click(Sender: TObject);
var
bmp:TBitMap;
begin
try
bmp:=TBitMap.Create ;
bmp.Assign(Image1.Picture);
DrawTransparent(bmp,Image2.Picture.Bitmap ,10,10);
image1.Picture.Assign(bmp);
image1.Refresh ;
finally
bmp.free;
end;
end;
if (Pox>sBmp.Width)or(PosY>sBmp.Height ) then
Exit;以防止画的坐标超出背景图象大小!!
TBitmap对象有个TransparentColor属性,设置一下就可以了,很方便的。