我现在导入一幅图片,要将此图的某一种颜色设置为透明色,请问怎么实现?
请各位大侠指点。
请各位大侠指点。
解决方案 »
- 高手帮忙------求一个DIRegEx控件的简单用法
- 过份,发了半天的贴子,给我删了,居然也不说下删除原因
- 散分咯 , 要滴来
- 怎样把16进制数(字符串)转换为浮点数并显示出来!
- 自定义控件里我published一个TMemoryStream类型的property,但不能存入dfm文件里?
- 有没有朗读中文的控件或是有关这方面的源代码也行!
- 用DCOM进行MIDAS三层结构开发时,如何使client连接server时不要windows验证???
- paradox数据库可否设置自动备份功能?
- 如何作到安装程序完毕后,快捷方式放到桌面上?,如果不用工具(InstallShield Express)做,用代码如何实现呢?
- 来者有分,请大家帮讲讲TSplitter的用法了
- 质量管理系统报价
- 递归列出FTP根目录所有子目录的所有文件和子目录。。。请大家帮忙支个招....
var
p: PByteArray;
x, y: Integer;
Bmp: TBitmap;
begin
Bmp := TBitmap.Create;
Bmp.Assign(Image1.Picture.Bitmap);
Bmp.PixelFormat := pf24Bit;
for y := 0 to Bmp.Height - 1 do
begin
p := Bmp.scanline[y];
for x := 0 to Bmp.Width - 1 do
begin
//确定阀值为128
if (p[x * 3] < 246) and (p[x * 3] > 128) and (p[x * 3 + 1] >
128)
and (p[x * 3 + 1] < 246)
and (p[x * 3 + 2] > 128) and (p[x * 3 + 2] < 246) then
begin
p[x * 3] := p[x * 3] + 10;
p[x * 3 + 1] := p[x * 3 + 1] + 10;
p[x * 3 + 2] := p[x * 3 + 2] + 10;
end;
if (p[x * 3] > 10) and (p[x * 3] < 128) and (p[x * 3 + 1] >
10)
and (p[x *
3 + 1] < 128)
and (p[x * 3 + 2] > 10) and (p[x * 3 + 2] < 128) then
begin
p[x * 3] := p[x * 3] - 10;
p[x * 3 + 1] := p[x * 3 + 1] - 10;
p[x * 3 + 2] := p[x * 3 + 2] - 10;
end;
end;
end;
Image2.Picture.Bitmap.Assign(Bmp);
Bmp.Free;
end;
Tbitmap有关的属性:
1.TansparentColor: 透明色;
参看这张帖子吧