import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.canvas.Canvas; import javafx.scene.canvas.GraphicsContext; import javafx.scene.layout.HBox; import javafx.scene.layout.VBox; import javafx.scene.paint.Color; import javafx.scene.paint.CycleMethod; import javafx.scene.paint.LinearGradient; import javafx.scene.paint.Stop; import javafx.stage.Stage; public class PolyTransformFlushBugAll extends Application { public static double xpoints[] = { 10, 70, 10, 70 }; public static double ypoints[] = { 10, 10, 70, 70 }; @Override public void start(Stage stage) { Canvas cvsla = makeCanvas(false, false, false); Canvas cvslb = makeCanvas(false, false, true); VBox boxsl = new VBox(cvsla, cvslb); Canvas cvsga = makeCanvas(false, true, false); Canvas cvsgb = makeCanvas(false, true, true); VBox boxsg = new VBox(cvsga, cvsgb); Canvas cvfga = makeCanvas(true, true, false); Canvas cvfgb = makeCanvas(true, true, true); VBox boxfg = new VBox(cvfga, cvfgb); HBox box = new HBox(boxsl, boxsg, boxfg); stage.setScene(new Scene(box)); stage.show(); } public Canvas makeCanvas(boolean fill, boolean gon, boolean workaround) { Canvas cv = new Canvas(400, 400); GraphicsContext gc = cv.getGraphicsContext2D(); gc.setFill(Color.WHITE); gc.fillRect(0, 0, 400, 400); gc.scale(5, 5); if (workaround) { gc.fillRect(0, 0, 1, 1); } gc.setLineWidth(10); LinearGradient lg = new LinearGradient(0.0, 0.0, 70.0, 70.0, false, CycleMethod.REFLECT, new Stop(0.0, Color.BLUE), new Stop(1.0, Color.GREEN)); gc.setFill(lg); gc.setStroke(lg); if (fill) { if (gon) { gc.fillPolygon(xpoints, ypoints, xpoints.length); } else { throw new InternalError("no fillPolyLine"); } } else { if (gon) { gc.strokePolygon(xpoints, ypoints, xpoints.length); } else { gc.strokePolyline(xpoints, ypoints, xpoints.length); } } return cv; } }