2

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.

jmachnik
  • 1,120
  • 9
  • 19
  • If you put your opacity to 1.0 do you still see white, or does it look normal? – Tomas Bisciak May 05 '16 at 13:33
  • 1
    Still white with any opacity value. I figure out an idea for this problem. I need to hide the app ([link](https://docs.oracle.com/javase/8/javafx/api/javafx/stage/Stage.html#setIconified-boolean-), make a screenshot using external tool and then bring the app window back. It was a part of this app, but it didn't work well on Linux. I needed to fix the hide/show part and it is working now. – jmachnik May 05 '16 at 17:29

0 Answers0