//颜色透明度
var
g: TGPGraphics;
sb: TGPSolidBrush;
begin
g := TGPGraphics.Create(Canvas.Handle);
sb := TGPSolidBrush.Create(MakeColor(128,255,0,0)); {128表示半透明}
g.FillRectangle(sb,10,10,100,100);
sb.Free;
g.Free;
end;
//使用 GDI+ 的颜色类型
var
g: TGPGraphics;
sb: TGPSolidBrush;
color: TGPColor; {其实颜色是 DWORD 类型的}
begin
g := TGPGraphics.Create(Canvas.Handle);
color := aclRed;
sb := TGPSolidBrush.Create(color);
g.FillRectangle(sb,10,10,100,100);
sb.Free;
g.Free;
end;
//颜色混合模式
var
g:TGPGraphics;
p:TGPPen;
begin
g:=TGPGraphics.Create(Canvas.Handle);
//g.Clear(aclBlue); //如果底色设为蓝色,那么我们就能看到混合时会很明显
p:=TGPPen.Create(MakeColor(128,255,0,0),20);
g.SetCompositingMode(CompositingModeSourceCopy); //{改写背景色}
g.DrawLine(p,11,11,111,111);
g.SetCompositingMode(CompositingModeSourceOver); //{混合背景色, 默认值}
g.DrawLine(p,66,11,222,128);
p.Free;
g.Free;
end;