Upravit

Sdílet prostřednictvím


CGContext.AddQuadCurveToPoint(nfloat, nfloat, nfloat, nfloat) Method

Definition

Adds a quadratic Bézier curve to the current path.

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

Parameters

cpx
nfloat

X value for the control point.

cpy
nfloat

Y value for the control point.

x
nfloat

X value for the end of the curve.

y
nfloat

Y value for the end of the curve.

Remarks

All coordinates are in user space coordinates.

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 ();
	}
}              

Applies to