for (int i = 0, n = mWhiteArray.size(); i < n; i++) { Point whitePoint = mWhiteArray.get(i); int X = (int) ((whitePoint.x + (1-ratioPieceOfLineHeight)/2)*mLineHeight); int Y = (int) ((whitePoint.y + (1-ratioPieceOfLineHeight)/2)*mLineHeight); canvas.drawBitmap(mWhitePiece, X, Y, null); }