怎样在image上画图,图形只覆盖白色背景,而不覆盖有颜色的地方,就像荧光笔一样(200分)

  • 主题发起人 主题发起人 trancechow
  • 开始时间 开始时间
T

trancechow

Unregistered / Unconfirmed
GUEST, unregistred user!
netmeeting的白板好像是矢量的,每个图形都可以单独选择,我不想做成那个样子,只是点阵绘图就可以了
 
必须自己写算法,一点一点判断是不是白色后再画上去。
比如拷贝:
type
THsColor=Packed Record
B, //兰色分量
G, //绿色分量
R, //红色分量
U:Byte; //未使用或Alpha通道
end;
THsColorArray=Array [0..8*1024-1] of THsColor;
PHsColorArray=^THsColorArray;

THsPoints=Array of PHsColorArray;
//将BMP2拷贝到BMP1上去,注意BMP1和BMP2要一样大
procedure MyCopy(BMP1,BMP2:TBitmap);
var
i,j:Integer;
p1,p2:THsPoints;
White:THsColor;
begin
BMP1.PixelFormat:=pf32Bit;
BMP2.PixelFormat:=pf32bit;
SetLength(p1,BMP1.Height);
SetLength(p2,BMP2.Height);
for i:=0 to BMP1.Height-1 do p1:=BMP1.ScanLine;
for i:=0 to BMP2.Height-1 do p2:=BMP2.ScanLine;
white.R:=255; white.G:=255; white.B:=255; white.U:=0;
for i:=0 to BMP1.Height-1 do
for j:=0 to BMP1.Width-1 do
if Integer(P1)<>Integer(White) then
p1:=p2;
end;

实际上,您可以在BMP2上画好一些图形然后在拷贝到目标图上去,
因此只需要这样一个程序就可以完成所有操作了。[:)]
 
这个算法的速度能有多少
 
将白色部分选择为一个区域,并设置为IMAGE.CANVAS的剪裁区域即可。
 
后退
顶部