@Override public void changed(javafx.beans.value.ObservableValue<? extends State> o, State oldValue, State newValue) {
if (newValue == State.SUCCEEDED) {
final double svgWidth = prefWidth >= 0 ? prefWidth : getSvgWidth(eng);
final double svgHeight = prefHeight >= 0 ? prefWidth : getSvgHeight(eng);
SnapshotParameters params = new SnapshotParameters();
params.setFill(Color.TRANSPARENT);
params.setViewport(new Rectangle2D(0, 0, svgWidth, svgHeight));
view.snapshot(new Callback<SnapshotResult, Void>() {
@Override public Void call(SnapshotResult param) {
WritableImage snapshot = param.getImage();
ImageView image = new ImageView(snapshot);
if (callback != null) {
callback.call(image);
}
stage.hide();
return null;
}
}, params, outputImage);
}
}
});