我给你两个过程,搞定半透明效果;我还有将图片半透明叠加的,象photoshop的蚂蚁在爬的选定效果的过程,下次再给你
procedure blendColor(ACanvas: TCanvas; ARect: TRect; FColor: TColor; Value: byte);
var
w, h : integer;
bmp: TbitMap;
begin
bmp:=TbitMap.Create;
with ARect do begin
h:=Bottom-Top;
w:=Right-Left;
end;
try
with bmp do begin
height:=h;
Width:=w;
Canvas.CopyRect(Rect(0,0,w,h),ACanvas,ARect);
BlendBmp(bmp,FColor,value);
ACanvas.Draw(ARect.Top,ARect.Left,bmp);
end;
finally
bmp.Free;
end;
end;
function getAlphaColor(BackColor,ForeColor: TColor; alpha: integer): TColor;
var
R,G,B: integer;
begin
backColor:=TColor(backColor);
backColor:=colortoRGB(backColor);
ForeColor:=colortoRGB(ForeColor);
R:=(getRValue(backColor)*(255-alpha)+getRvalue(ForeColor)*alpha) div 255;
G:=(getGValue(backColor)*(255-alpha)+getGvalue(ForeColor)*alpha) div 255;
B:=(getBValue(backColor)*(255-alpha)+getBvalue(ForeColor)*alpha) div 255;
if R>255 then R:=255;
if R<0 then R:=0;
if G>255 then G:=255;
if G<0 then R:=0;
if B>255 then B:=255;
if B<0 then B:=0;
result:=RGB(R,G,B);
end;