导航:  GdiPlus Classes > GdiPlus Classes > CGpGraphics Class > Graphics Object >

DrawBezier

上一页返回章节概述下一页

描述

 

Draws a B閦ier spline.

 

C++ Syntax

 

Status DrawBezier(

[in]  const Pen *pen,

[in]  REAL x1,

[in]  REAL y1,

[in]  REAL x2,

[in]  REAL y2,

[in]  REAL x3,

[in]  REAL y3,

[in]  REAL x4,

[in]  REAL y4

);

 

Status DrawBezier(

[in]  const Pen *pen,

[in]  INT x1,

[in]  INT y1,

[in]  INT x2,

[in]  INT y2,

[in]  INT x3,

[in]  INT y3,

[in]  INT x4,

[in]  INT y4

);

 

Status DrawBezier(

[in]       const Pen *pen,

[in, ref]  const POINTF &pt1,

[in, ref]  const POINTF &pt2,

[in, ref]  const POINTF &pt3,

[in, ref]  const POINTF &pt4

);

 

Status DrawBezier(

[in]       const Pen *pen,

[in, ref]  const POINT &pt1,

[in, ref]  const POINT &pt2,

[in, ref]  const POINT &pt3,

[in, ref]  const POINT &pt4

);

 

FreeBASIC 语法

 

FUNCTION DrawBezier ( _

BYVAL pPen AS CGpPen PTR, _

BYVAL x1 AS SINGLE, _

BYVAL y1 AS SINGLE, _

BYVAL x2 AS SINGLE, _

BYVAL y2 AS SINGLE, _

BYVAL x3 AS SINGLE, _

BYVAL y3 AS SINGLE, _

BYVAL x4 AS SINGLE, _

BYVAL y4 AS SINGLE _

) AS GpStatus

 

FUNCTION DrawBezier ( _

BYVAL pPen AS CGpPen PTR, _

BYVAL x1 AS INT_, _

BYVAL y1 AS INT_, _

BYVAL x2 AS INT_, _

BYVAL y2 AS INT_, _

BYVAL x3 AS INT_, _

BYVAL y3 AS INT_, _

BYVAL x4 AS INT_, _

BYVAL y4 AS INT_ _

) AS GpStatus

 

FUNCTION DrawBezier ( _

BYVAL pPen AS CGpPen PTR, _

BYVAL pt1 AS GpPointF _

) AS GpStatus

 

FUNCTION DrawBezier ( _

BYVAL pPen AS CGpPen PTR, _

BYVAL pt1 AS GpPoint _

) AS GpStatus

 

参数

 

pPen

 

[in] Pointer to a pen that is used to draw the B閦ier spline.

 

x1

 

[in] Simple precision number that specifies the x-coordinate of the starting point of the B閦ier spline.

 

y1

 

[in] Simple precision number that specifies the y-coordinate of the starting point of the B閦ier spline.

 

x2

 

[in] Simple precision number that specifies the x-coordinate of the first control point of the B閦ier spline.

y2

 

[in] Simple precision number that specifies the y-coordinate of the first control point of the B閦ier spline.

 

x3

 

[in] Simple precision number that specifies the x-coordinate of the second control point of the B閦ier spline.

 

y3

 

[in] Simple precision number that specifies the y-coordinate of the second control point of the B閦ier spline.

 

x4

 

[in] Simple precision number that specifies the x-coordinate of the ending point of the B閦ier spline.

 

y4

 

[in] Simple precision number that specifies the y-coordinate of the ending point of the B閦ier spline.

 

返回值

 

如果该方法成功,则返回Ok,这是对Status枚举元素.

如果这个方法失败,它返回一个枚举的其他元素的Status.

 

引用文件

 

CGpBitmap.inc (include CGdiPlus.inc)

 

示例

 

' ========================================================================================

' The following example draws a B閦ier curve.

' ========================================================================================

SUB Example_DrawBezier (BYVAL hdc AS HDC)

 

  ' // Create a graphics object from the window device context

  DIM graphics AS CGpGraphics = hdc

  ' // Get the DPI scaling ratio

  DIM rxRatio AS SINGLE = graphics.GetDpiX / 96

  DIM ryRatio AS SINGLE = graphics.GetDpiY / 96

  ' // Set the scale transform

  graphics.ScaleTransform(rxRatio, ryRatio)

 

  ' // Draw the curve.

  DIM greenPen AS CGpPen = GDIP_ARGB(255, 0, 255, 0)

  graphics.DrawBezier(@greenPen, 100.0, 100.0, 200.0, 10.0, 350.0, 50.0, 500.0, 100.0)

 

  ' // Draw the end points and control points.

  DIM redBrush AS CGpSolidBrush = GDIP_ARGB(255, 255, 0, 0)

  DIM blueBrush AS CGpSolidBrush = GDIP_ARGB(255, 0, 0, 255)

  graphics.FillEllipse(@redBrush, 100 - 5, 100 - 5, 10, 10)

  graphics.FillEllipse(@redBrush, 500 - 5, 100 - 5, 10, 10)

  graphics.FillEllipse(@blueBrush, 200 - 5, 10 - 5, 10, 10)

  graphics.FillEllipse(@blueBrush, 350 - 5, 50 - 5, 10, 10)

 

END SUB

' ========================================================================================