i'm new to JavaFX and i'm trying to draw some things on a canvas.
First I'm setting the linecolor to black and draw a line.
canvas.getGraphicsContext2D().setStroke(Color.BLACK);
canvas.getGraphicsContext2D().strokeLine(20,20,100,100);
After this I'm trying to erase this line by draw a white line over this line:
canvas.getGraphicsContext2D().setStroke(Color.WHITE);
canvas.getGraphicsContext2D().strokeLine(20,20,100,100);
But there will be some gray pixels left on canvas. What is the reason for this and how can i prevent this?
this ist the way i create the scene
Pane root = new Pane();
canvas = new Canvas(200, 200);
GraphicsContext gc = canvas.getGraphicsContext2D();
gc.strokeLine(20,20,100,100);
scene = new Scene(root, 200, 200);
this.setColor(Color.WHITE);
root.getChildren().add(canvas);
Thanks, Martin