remplaced canvas to draw segment by rectangle