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

//闭合曲线
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;

时间: 2024-10-14 22:33:24

Delphi GDI+学习记录(18): 闭合曲线的相关文章

Delphi GDI+学习记录(16): 贝塞尔曲线

//画贝塞尔曲线 var g: TGPGraphics; p: TGPPen; begin g := TGPGraphics.Create(Canvas.Handle); p := TGPPen.Create(MakeColor(255,0,0),2); g.DrawBezier(p, 11,11, 88,333, 99,0, 222,111); {参数是画笔与 4 个点的坐标} p.Free; g.Free; end; //使用 TGPPoint 或 TGPPointF var g: TGPG

Delphi GDI+学习记录(17): 曲线

//画曲线var g: TGPGraphics; p: TGPPen; pts: array[0..4] of TGPPoint; begin g := TGPGraphics.Create(Canvas.Handle); p := TGPPen.Create(MakeColor(255,0,0),4); pts[0].X := 11; pts[0].Y := 11; pts[1].X := 66; pts[1].Y := 66; pts[2].X := 88; pts[2].Y := 222;

Delphi GDI+ 学习记录(28): 图像颜色的数据格式

//指定位图颜色var g,gbit: TGPGraphics; bit1,bit2: TGPBitmap; sb: TGPSolidBrush; begin //Self.Color := clWhite; g := TGPGraphics.Create(Canvas.Handle); sb := TGPSolidBrush.Create(MakeColor(255,0,0)); {画刷为红色} bit1 := TGPBitmap.Create(200, 32, PixelFormat32bp

Delphi GDI+学习记录(21): 颜色

//颜色透明度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:

Delphi GDI+学习记录(19): 路径

//绘制与填充路径var g: TGPGraphics; path: TGPGraphicsPath; p: TGPPen; sb: TGPSolidBrush; begin g := TGPGraphics.Create(Canvas.Handle); p := TGPPen.Create(MakeColor(128,255,0,0),4); sb := TGPSolidBrush.Create(MakeColor(128,255,255,0)); path := TGPGraphicsPat

Delphi GDI+学习记录(9): 纹理画刷

//纹理画刷 var g: TGPGraphics; img: TGPImage; tb: TGPTextureBrush; begin g := TGPGraphics.Create(Canvas.Handle); img := TGPImage.Create('c:\temp\small.jpg'); tb := TGPTextureBrush.Create(img); g.FillEllipse(tb, 0, 0, Self.ClientWidth, Self.ClientHeight);

Delphi GDI+学习记录(8): 阴影画刷

//阴影画刷 var g: TGPGraphics; hb: TGPHatchBrush; begin g := TGPGraphics.Create(Canvas.Handle); hb := TGPHatchBrush.Create(HatchStyleHorizontal, aclRed, aclYellow); {参数1是阴影样式; 参数2是前景色; 参数3是背景色, 参数3可选, 默认黑色} g.FillEllipse(hb, 11, 11, 222, 111); hb.Free; g

Delphi GDI+学习记录(4): 画笔对齐

//笔对齐 var g: TGPGraphics; p: TGPPen; sb: TGPSolidBrush; rect: TGPRect; begin g := TGPGraphics.Create(Canvas.Handle); p := TGPPen.Create(MakeColor(255,255,0,0),5); sb := TGPSolidBrush.Create(MakeColor(255,255,255,0)); p.SetAlignment(PenAlignmentCenter

Delphi GDI+学习记录(3): 虚线画笔

//虚线样式 var g: TGPGraphics; p: TGPPen; begin g := TGPGraphics.Create(Canvas.Handle); p := TGPPen.Create(MakeColor(255,255,0,0),3); g.DrawLine(p, 11, 11, 333, 11); {实线} p.SetDashStyle(DashStyleDashDot); {设置虚线样式} g.DrawLine(p, 11, 33, 333, 33); {绘制任何形状都