This is a followup on a previous question (see Coloring individual triangles in a triangle mesh on javafx) which I believe is another topic on its own.
Is there a way (w
You might create the texture to be used for fill etc. in your code by using any graphic object and convert that into an image in memory, not touching disk.
The example below will create a texture using a green spline.
Pane testImage2(Pane pane) {
Pane inner = new Pane();
inner.prefWidthProperty().bind(pane.widthProperty());
inner.prefHeightProperty().bind(pane.heightProperty());
pane.getChildren().add(inner);
SVGPath texture = new SVGPath();
texture.setStroke(Color.GREEN);
texture.setStrokeWidth(2.5);
texture.setFill(Color.TRANSPARENT);
texture.setContent("M 10 10 C 40 10 10 70 70 20");
SnapshotParameters params = new SnapshotParameters();
params.setViewport(new Rectangle2D(-5, -5, 70, 50));
Image image = texture.snapshot(params, null);
Paint paint = new ImagePattern(image, 5,5, 20, 20, false);
inner.setBackground(new Background(new BackgroundFill(paint, new CornerRadii(0), new Insets(inset))));
return pane;
}