JDK-8123319 : Canvas: error with GraphicsContext.setStroke(new LinearGradient( ...
Type:Bug
Component:javafx
Sub-Component:graphics
Affected Version:8
Priority:P3
Status:Resolved
Resolution:Duplicate
Submitted:2013-07-11
Updated:2015-06-17
Resolved:2013-08-12
The Version table provides details related to the release that this issue/RFE will be addressed.
Unresolved : Release in which this issue/RFE will be addressed. Resolved: Release in which this issue/RFE has been resolved. Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.
run application attached: there is a canvas with an oval in it.
the oval is drawn using setStroke(new LinearGradient( ...
see screenshot:
actual (left) and expected (right)
Joe, Jim: can you reproduce this problem on your Windows ?
Thanks
23-07-2013
Thank you Victor.
Not sure what to tell you, it works fine for me on my Windows 7 and 8.
23-07-2013
same bug with your source code.
environment: Win7, promotion build 99.
same bug with hardware and software rendering.
23-07-2013
works for me on Mac and Windows
Again, I had to change the test case in order for it to run mac.
Please let me know if you see the problem with the following start()
@Override
public void start(Stage primaryStage) throws Exception {
final Canvas canvas = new Canvas(120, 120);
GraphicsContext gc = canvas.getGraphicsContext2D();
gc.setStroke(new LinearGradient(
0,
0,
1,
4,
true,
CycleMethod.NO_CYCLE,
new Stop[] { new Stop(0, Color.RED), new Stop(0.3f, Color.BLUE) }));
gc.setLineWidth(18f);
gc.stroke();
gc.strokeOval(DEFAULT_RADIUS / 2, DEFAULT_RADIUS / 2,
2 * DEFAULT_RADIUS, DEFAULT_RADIUS);
Pane pane = new VBox(canvas);
pane.setPrefSize(180, 190);
pane.setStyle("-fx-border-color: darkgray;");
Group root = new Group(pane);
primaryStage.setScene(new Scene(root, 300, 300));
primaryStage.show();
}