我试图创建一个模糊的背景。
<StackPane id="blurLayer">
<children>
<ImageView id="blurImage" fitHeight="478.0" fitWidth="328.0">
<effect>
<BoxBlur height="10.0" width="10.0" />
</effect>
</ImageView>
</children>
</StackPane>
ImageView
的图像会在需要时更新:
SnapshotParameters params = new SnapshotParameters();
params.setFill(Color.web("#242424"));
WritableImage snapshot = gameLayer.snapshot(params, null);
blurImage.setImage(snapshot);