CGContext.AddCurveToPoint Método

Definição

Adiciona uma curva de Bézier cúbica no ponto atual, com os parâmetros de controle especificados.

public void AddCurveToPoint (nfloat cp1x, nfloat cp1y, nfloat cp2x, nfloat cp2y, nfloat x, nfloat y);
member this.AddCurveToPoint : nfloat * nfloat * nfloat * nfloat * nfloat * nfloat -> unit

Parâmetros

cp1x
nfloat

O valor x do primeiro ponto de controle.

cp1y
nfloat

O valor y do primeiro ponto de controle.

cp2x
nfloat

O valor x do segundo ponto de controle.

cp2y
nfloat

O valor y do segundo ponto de controle.

x
nfloat

O valor x no qual a curva de Bézier deve terminar.

y
nfloat

O valor y no qual a curva de Bézier deve terminar.

Comentários

Todas as coordenadas estão em coordenadas de espaço do usuário.

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

		ctxt.SetStrokeColor (UIColor.Red.CGColor);
		ctxt.MoveTo (startingPoint.X, startingPoint.Y);
		ctxt.AddCurveToPoint (controlPoint1.X, controlPoint1.Y, controlPoint2.X, controlPoint2.Y, endingPoint.X, endingPoint.Y);
		ctxt.StrokePath ();

		//Illustrate parameters
		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(controlPoint1), sz));
		ctxt.AddEllipseInRect (new RectangleF (offset(controlPoint2), sz));
		ctxt.AddEllipseInRect (new RectangleF (offset(endingPoint), sz));
		ctxt.StrokePath();
	}
}

Aplica-se a