Method function IGDIPlus.IGPGraphics.DrawBezierF(IGPPen;TGPPointF;TGPPointF;TGPPointF;TGPPointF) : TGPGraphics
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 DrawBezierF( pen : IGPPen, pt1 : TGPPointF, pt2 : TGPPointF, pt3 : TGPPointF, pt4 : TGPPointF ) : TGPGraphics;
C++ Builder:
TGPGraphics __fastcall DrawBezierF( IGPPen pen, TGPPointF pt1, TGPPointF pt2, TGPPointF pt3, TGPPointF pt4 );
Visual C++ (MFC):
DrawBezierF( 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 : TGPPointF; AControlPoint1 : TGPPointF; AControlPoint2 : TGPPointF; AEndPoint : TGPPointF; begin AGraphics := TGPGraphics.Create( ACanvas ); // Set up the pen and curve points. Pen greenPen(Color(255, 0, 255, 0)); AStartPoint := MakePointF(100.0, 100.0); AControlPoint1 := MakePointF(200.0, 10.0); AControlPoint2 := MakePointF(350.0, 50.0); AEndPoint := MakePointF(500.0, 100.0); //Draw the curve. AGraphics.DrawBezierF( 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.