Method function IGDIPlus.IGPGraphics.DrawBezier(IGPPen;Integer;Integer;Integer;Integer;Integer;Integer;Integer;Integer) : TGPGraphics

From Mitov Wiki Doc
Jump to: navigation, search

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, x1 : Integer, y1 : Integer, x2 : Integer, y2 : Integer, x3 : Integer, y3 : Integer, x4 : Integer, y4 : Integer ) : TGPGraphics;

C++ Builder:

TGPGraphics __fastcall DrawBezier( IGPPen pen, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4 );

Visual C++ (MFC):

DrawBezier(  pen,  x1,  y1,  x2,  y2,  x3,  y3,  x4,  y4 );

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;

begin
  AGraphics := TGPGraphics.Create( ACanvas );


  // Set up the pen and curve points.
  Pen greenPen(Color(255, 0, 255, 0));

   //Draw the curve.
  AGraphics.DrawBezier( TGLPen.Create( aclGreen ), 100, 100, 200, 10, 350, 50, 500, 100 );

   //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.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox