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

DrawCurve

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

描述

 

绘制基数样条.

 

C++ Syntax

 

Status DrawCurve(

[in]  const Pen *pen,

[in]  const PointF *points,

[in]  INT count

);

 

Status DrawCurve(

[in]  const Pen *pen,

[in]  const Point *points,

[in]  INT count

);

 

Status DrawCurve(

[in]  const Pen *pen,

[in]  const PointF *points,

[in]  INT count,

[in]  REAL tension

);

 

Status DrawCurve(

[in]  const Pen *pen,

[in]  const Point *points,

[in]  INT count,

[in]  REAL tension

);

 

Status DrawCurve(

[in]  const Pen *pen,

[in]  const PointF *points,

[in]  INT count,

[in]  INT offset,

[in]  INT numberOfSegments,

[in]  REAL tension

);

 

Status DrawCurve(

[in]  const Pen *pen,

[in]  const Point *points,

[in]  INT count,

[in]  INT offset,

[in]  INT numberOfSegments,

[in]  REAL tension

);

 

FreeBASIC 语法

 

FUNCTION DrawCurve ( _

   BYVAL pPen AS CGpPen PTR, _

   BYVAL pts AS GpPointF PTR, _

   BYVAL count AS INT_ _

) AS GpStatus

 

FUNCTION DrawCurve ( _

   BYVAL pPen AS CGpPen PTR, _

   BYVAL pts AS GpPoint PTR, _

   BYVAL count AS INT_ _

) AS GpStatus

 

FUNCTION DrawCurve ( _

   BYVAL pPen AS CGpPen PTR, _

   BYVAL pts AS GpPointF PTR, _

   BYVAL count AS INT_, _

   BYVAL tension AS SINGLE _

) AS GpStatus

 

FUNCTION DrawCurve ( _

   BYVAL pPen AS CGpPen PTR, _

   BYVAL pts AS GpPoint PTR, _

   BYVAL count AS INT_, _

   BYVAL tension AS SINGLE _

) AS GpStatus

 

FUNCTION DrawCurve ( _

   BYVAL pPen AS CGpPen PTR, _

   BYVAL pts AS GpPointF PTR, _

   BYVAL count AS INT_, _

   BYVAL tension AS SINGLE _

) AS GpStatus

 

FUNCTION DrawCurve ( _

   BYVAL pPen AS CGpPen PTR, _

   BYVAL pts AS GpPointF PTR, _

   BYVAL count AS INT_, _

   BYVAL offset AS INT_, _

   BYVAL numberOfSegments AS INT_,

   BYVAL tension AS SINGLE _

) AS GpStatus

 

FUNCTION DrawCurve ( _

   BYVAL pPen AS CGpPen PTR, _

   BYVAL pts AS GpPoint PTR, _

   BYVAL count AS INT_, _

   BYVAL offset AS INT_, _

   BYVAL numberOfSegments AS INT_,

   BYVAL tension AS SINGLE _

) AS GpStatus

 

参数

 

pPen

 

[in]指针一笔用于绘制基数样条.

 

pts

 

[in]指向PointF对象指定的基数样条曲线通过坐标数组.

 

count

 

[in]整数,指定的点的数组元素个数.

 

offset

 

[in]整数指定元素的数组,指定点的点的基数样条曲线开始.

 

numberOfSegments

 

[in]整数,指定的基数样条段数.

 

tension

 

[in]简单精度数,指定如何紧密的曲线弯曲的基数样条曲线的坐标.

 

返回值

 

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

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

 

备注

 

段被定义为在主样条中连接两个连续点的曲线.每个段的结束点是下一个的出发点.

 

引用文件

 

CGpBitmap.inc (include CGdiPlus.inc)

 

示例

 

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

' The following example draws a cardinal spline.

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

SUB Example_DrawCurve (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)

 

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

 

  DIM point1 AS GpPointF : point1.x = 100.0 : point1.y = 100.0

  DIM point2 AS GpPointF : point2.x = 200.0 : point2.y = 50.0

  DIM point3 AS GpPointF : point3.x = 400.0 : point3.y = 10.0

  DIM point4 AS GpPointF : point4.x = 500.0 : point4.y = 100.0

 

  DIM curvePoints(3) AS GpPointF

  curvePoints(0) = point1

  curvePoints(1) = point2

  curvePoints(2) = point3

  curvePoints(3) = point4

 

  ' // Draw the curve.

  graphics.DrawCurve(@greenPen, @curvePoints(0), 4)

 

  ' // Draw the points in the curve.

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

  graphics.FillEllipse(@redBrush, 95, 95, 10, 10)

  graphics.FillEllipse(@redBrush, 195, 45, 10, 10)

  graphics.FillEllipse(@redBrush, 395, 5, 10, 10)

  graphics.FillEllipse(@redBrush, 495, 95, 10, 10)

 

END SUB

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