Compartir a través de


CGContext.AddQuadCurveToPoint(nfloat, nfloat, nfloat, nfloat) Método

Definición

Agrega una curva Bézier cuadrática al trazado actual.

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

Parámetros

cpx
nfloat

Valor X del punto de control.

cpy
nfloat

Valor Y del punto de control.

x
nfloat

Valor X para el final de la curva.

y
nfloat

Valor Y para el final de la curva.

Comentarios

Todas las coordenadas están en coordenadas de espacio de usuario.

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

Se aplica a