CGContext.AddQuadCurveToPoint(nfloat, nfloat, nfloat, nfloat) 方法

定义

将二次贝塞尔曲线添加到当前路径。

public void AddQuadCurveToPoint (nfloat cpx, nfloat cpy, nfloat x, nfloat y);
member this.AddQuadCurveToPoint : nfloat * nfloat * nfloat * nfloat -> unit

参数

cpx
nfloat

控制点的 X 值。

cpy
nfloat

控制点的 Y 值。

x
nfloat

曲线终点的 X 值。

y
nfloat

曲线终点的 Y 值。

注解

所有坐标都在用户空间坐标中。

public override void Draw (RectangleF rect)
{
	base.Draw (rect);
	using (var ctxt = UIGraphics.GetCurrentContext ()) {
		var startingPoint = new PointF (100, 100);
		var controlPoint = new PointF (20, 100);
		var endingPoint = new PointF (120, 120);

		ctxt.SetStrokeColor (UIColor.Red.CGColor);
		ctxt.MoveTo (startingPoint.X, startingPoint.Y);
		ctxt.AddQuadCurveToPoint (c.X, c.Y, endingPoint.X, endingPoint.Y);
		ctxt.StrokePath ();

		//Illustrate control point
		ctxt.SetStrokeColor (UIColor.Black.CGColor);
		var sz = new SizeF (2, 2);
		Func<PointF,PointF> offset = (PointF pt) => new PointF (pt.X - 1, pt.Y - 1);
		ctxt.AddEllipseInRect (new RectangleF (offset (startingPoint), sz));
		ctxt.AddEllipseInRect (new RectangleF (offset (c), sz));
		ctxt.AddEllipseInRect (new RectangleF (offset (endingPoint), sz));
		ctxt.StrokePath ();
	}
}              

适用于