Method function IGDIPlus.IGPGraphics.DrawBezier(IGPPen;TGPPoint;TGPPoint;TGPPoint;TGPPoint) : TGPGraphics
From Mitov Wiki Doc
This is a Beta Read Only version of this page. Please review and send recommendations to mitov@mitov.com. We will enable the editing as soon as we are happy with the overall Wiki site.
Class: IGPGraphics
Contents |
Syntax
Delphi:
function DrawBezier( pen : IGPPen, pt1 : TGPPoint, pt2 : TGPPoint, pt3 : TGPPoint, pt4 : TGPPoint ) : TGPGraphics;
C++ Builder:
TGPGraphics __fastcall DrawBezier( IGPPen pen, TGPPoint pt1, TGPPoint pt2, TGPPoint pt3, TGPPoint pt4 );
Visual C++ (MFC):
DrawBezier( pen, pt1, pt2, pt3, pt4 );
Summary
Draws a Bézier spline.
Description
Call this method to draw a Bézier spline.
Example:
The following example draws a Bézier curve.
var AGraphics : IGPGraphics; APath : IGPGraphicsPath; ARedBrush : IGSolidBrush; ABlueBrush : IGSolidBrush; ASartPoint : TGPPoint; AControlPoint1 : TGPPoint; AControlPoint2 : TGPPoint; AEndPoint : TGPPoint; begin AGraphics := TGPGraphics.Create( ACanvas ); // Set up the pen and curve points. Pen greenPen(Color(255, 0, 255, 0)); AStartPoint := MakePoint(100, 100); AControlPoint1 := MakePoint(200, 10); AControlPoint2 := MakePoint(350, 50); AEndPoint := MakePoint(500, 100); //Draw the curve. AGraphics.DrawBezier( TGLPen.Create( aclGreen ), AStartPoint, AControlPoint1, AControlPoint2, AEndPoint); //Draw the end points and control points. ARedBrush := TGSolidBrush.Create( aclRed ); ABlueBrush := TGSolidBrush.Create( aclBlue ); AGraphics.FillEllipse(ARedBrush, 100 - 5, 100 - 5, 10, 10); AGraphics.FillEllipse(ARedBrush, 500 - 5, 100 - 5, 10, 10); AGraphics.FillEllipse(ABlueBrush, 200 - 5, 10 - 5, 10, 10); AGraphics.FillEllipse(ABlueBrush, 350 - 5, 50 - 5, 10, 10);
Remarks A Bézier spline does not pass through its control points. The control points act as magnets, pulling the curve in certain directions to influence the way the Bézier spline bends.