1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
private Bitmap quadrillage_echelle;
private Bitmap drawPlan() {
if (scale != 0) {
if (quadrillage_echelle != null) {
quadrillage_echelle.recycle();
quadrillage_echelle = null;
}
quadrillage_echelle = Bitmap.createBitmap(getWidth(), getHeight(),
Config.ARGB_8888);
Canvas canvas = new Canvas(quadrillage_echelle);
Paint paint = new Paint();
paint.setColor(Color.argb(20, 0, 0, 0));
paint.setStrokeWidth(1);
for (float x = 0; x < getWidth(); x = x + (float) scale) {
canvas.drawLine(x, 0, x, getHeight(), paint);
}
for (float y = 0; y < getHeight(); y = y + (float) scale) {
canvas.drawLine(0, y, getWidth(), y, paint);
}
paint.setStrokeWidth(3);
return quadrillage_echelle;
}
return null;
} |
Partager