Canvas : 2 pixel thick line width
Damien Dudouit
ddudouit at clio.ch
Wed Apr 1 09:42:25 UTC 2015
Hello,
I'm using a Canvas to display some content (mostly text with lines also for
underline).
I've just noticed something that is a big problem for me : with
line-width=1 and no scaling, actual line-width on display takes 2 pixels.
Canvas canvas = new Canvas(300, 300);
GraphicsContext gc = canvas.getGraphicsContext2D();
gc.setStroke(Color.BLACK);
gc.setLineWidth(1);
gc.strokeLine(10, 10, 110, 10);
I'm running Win7 64bits and I have made the test with Oracle jdk8_40 and
jdk7_71 and the result is the same.
That 2 pixel thick line is not perfectly black but dark gray.
If I do 'gc.setLineWidth(2)', then I get a 2 pixel thick line perfectly
black.
If I do 'gc.setLineWidth(0.5)', then I get a 2 pixel thick line with a
lighter gray.
I want to display underline text in the canvas and a 2 pixel thick
underline looks bad.
Any help would be greatly appreciated.
Damien
More information about the openjfx-dev
mailing list