GDI+ 学习记录(18): 闭合曲线 - ClosedCurve

//闭合曲线
var
  g: TGPGraphics;
  p: TGPPen;
  sb: TGPSolidBrush;
  pts: array[0..4] of TGPPoint;
begin
  g := TGPGraphics.Create(Canvas.Handle);
  sb := TGPSolidBrush.Create(MakeColor(255,255,255));
  p := TGPPen.Create(MakeColor(255,0,0),4);

  pts[0].X := 77;  pts[0].Y := 44;
  pts[1].X := 66;  pts[1].Y := 111;
  pts[2].X := 88;  pts[2].Y := 222;
  pts[3].X := 111; pts[3].Y := 88;
  pts[4].X := 222; pts[4].Y := 66;

  g.DrawClosedCurve(p, PGPPoint(@pts), Length(pts), 2.5);
  {参数 4 是曲度, 可选, 默认 0.5}

  g.FillClosedCurve(sb, PGPPoint(@pts), Length(pts), FillModeAlternate, 2.5);
  {既然是闭合的就可以填充, 参数 4 是填充模式, 另一个可选值是: FillModeWinding}

  p.Free;
  sb.Free;
  g.Free;
end;

你可能感兴趣的:(close)