I need to make a screenshot of desktop in my application. Application shows transparent pane on whole screen and need to take a snapshot of user's dekstop.
stage.initStyle(StageStyle.TRANSPARENT);
stage.setScene(scene);
stage.setOpacity(0.2);
I tried following code samples, using Snapshots.
SnapshotParameters sp = new SnapshotParameters();
sp.setFill(Color.TRANSPARENT);
...
ImageIO.write(SwingFXUtils.fromFXImage(canvas.snapshot(sp, wi), null), "png", file);
But without any success. My pane on screenshots is not transparent, it's white instead. I've tried to use AWT Robot to this taks, but it also failed.