Condividi tramite


CGContext.AddQuadCurveToPoint(nfloat, nfloat, nfloat, nfloat) Metodo

Definizione

Aggiunge una curva quadratica Bézier al percorso corrente.

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

Parametri

cpx
nfloat

Valore X per il punto di controllo.

cpy
nfloat

Valore Y per il punto di controllo.

x
nfloat

Valore X per la fine della curva.

y
nfloat

Valore Y per la fine della curva.

Commenti

Tutte le coordinate sono in coordinate dello spazio utente.

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

Si applica a