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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
public void drawElement(int width, int height) {
double nbPixelByTwo = (2 * Wall.getNbMetre_by_pixel());
double scaleModify = (Plan.getScale() / Plan.getScaleStd());
if (isSelected()) {
if (bitmapWall != null) {
bitmapWall.recycle();
bitmapWall = null;
}
bitmapWall = Bitmap.createBitmap(width, height, Config.ARGB_8888);
canvasWall = new Canvas(bitmapWall);
paintWall = new Paint();
/** Couleur du Mur selectionne **/
paintWall.setColor(Color.RED);
/** Epaisseur du trait **/
paintWall.setStrokeWidth(getEpaisseur());
/** Dessine le Mur **/
canvasWall.drawLine(
(float) ((getPosX_DebElt() / nbPixelByTwo) * scaleModify),
(float) ((getPosY_DebElt() / nbPixelByTwo) * scaleModify),
(float) ((getPosX_FinElt() / nbPixelByTwo) * scaleModify),
(float) ((getPosY_FinElt() / nbPixelByTwo) * scaleModify),
paintWall);
} else {
if (bitmapWall != null) {
bitmapWall.recycle();
bitmapWall = null;
}
bitmapWall = Bitmap.createBitmap(width, height, Config.ARGB_8888);
canvasWall = new Canvas(bitmapWall);
paintWall = new Paint();
/** Couleur du Mur **/
paintWall.setColor(Color.GRAY);
/** Definir une épaisseur de trait **/
paintWall.setStrokeWidth(getEpaisseur());
/** Dessine le Mur **/
canvasWall.drawLine(
(float) ((getPosX_DebElt() / nbPixelByTwo) * scaleModify),
(float) ((getPosY_DebElt() / nbPixelByTwo) * scaleModify),
(float) ((getPosX_FinElt() / nbPixelByTwo) * scaleModify),
(float) ((getPosY_FinElt() / nbPixelByTwo) * scaleModify),
paintWall);
}
} |
Partager