Tout ce que je voulais, je pouvais pour le produire en utilisant le code suivant:
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
PointF mPoint1 = new PointF(w/1.2F, h/1.2F);
PointF mPoint2 = new PointF(w/24, h/1.2F);
Path myPath1 = new Path();
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setStyle(Style.STROKE);
paint.setStrokeWidth(2);
paint.setColor(Color.WHITE);
myPath1 = drawCurve(canvas, paint, mPoint1, mPoint2);
canvas.drawPath(myPath1, paint);
}
private Path drawCurve(Canvas canvas, Paint paint, PointF mPointa, PointF mPointb) {
Path myPath = new Path();
myPath.moveTo(63*w/64, h/10);
myPath.quadTo(mPointa.x, mPointa.y, mPointb.x, mPointb.y);
return myPath;
}
Ceci trouvera les deux côtés de l'écran (Mode Paysage) et dessine une courbe parfaite sur l'écran.
Quel type de courbe? Un arc de cercle? –
Je dois dessiner un arc parfait – Sen
Vous ne pouvez pas dessiner un cercle parfait en utilisant 2 courbes de Bézier, mais vous pouvez en ajouter d'autres pour l'approximer –