測試效果圖:
測試代碼:
uses GdiPlus;
procedure TForm1.FormPaint(Sender: TObject);
var
Graphics: IGPGraphics;
Brush: IGPPathGradIEntBrush;
Rect: TGPRect;
Path: IGPGraphicsPath;
begin
Graphics := TGPGraphics.Create(Handle);
Rect.Initialize(10 , 10, 180, 100);
Path := TGPGraphicsPath.Create;
Path.AddEllipse(Rect);
Brush := TGPPathGradIEntBrush.Create(Path);
Brush.CenterColor := $FF00FF00;
Brush.SetSurroundColors([$FF000000]);
Brush.SetFocusScales(0, 0); //這是默認設置
Graphics.FillEllipse(Brush, Rect);
Brush.SetFocusScales(0.5, 0);
Graphics.TranslateTransform(0, Rect.Y + Rect.Height);
Graphics.FillEllipse(Brush, Rect);
Brush.SetFocusScales(0, 0.5);
Graphics.TranslateTransform(0, Rect.Y + Rect.Height);
Graphics.FillEllipse(Brush, Rect);
end;