1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| public class Dessin extends View {
...
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
DashPathEffect dashLR = new DashPathEffect(new float[] {20, 10}, 0); //Ligne en pointillés
public Dessin(Context context) {
super(context);
}
@Override
protected void onDraw(Canvas cnv) {
super.onDraw(cnv);
try {
...
if (i.affOK) { //Affichage de la droite de ralliement
paint.setStyle(Style.STROKE);
paint.setStrokeWidth(6);
paint.setPathEffect(dashLR); // Ligne en pointillés
paint.setColor(Color.YELLOW); //jaune
cnv.drawLine(affX/2, affY/2, x1, y1, paint); // Droite de ralliement
} |
Partager