Java Code Examples for javafx.scene.Scene#snapshot()
The following examples show how to use
javafx.scene.Scene#snapshot() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RadialColorMenuDemo.java From RadialFx with GNU Lesser General Public License v3.0 | 6 votes |
private void takeSnapshot(final Scene scene) { // Take snapshot of the scene final WritableImage writableImage = scene.snapshot(null); // Write snapshot to file system as a .png image final File outFile = new File("snapshot/radialmenu-snapshot-" + snapshotCounter + ".png"); outFile.getParentFile().mkdirs(); try { ImageIO.write(SwingFXUtils.fromFXImage(writableImage, null), "png", outFile); } catch (final IOException ex) { System.out.println(ex.getMessage()); } snapshotCounter++; }
Example 2
Source File: RadialSettingsMenuDemo.java From RadialFx with GNU Lesser General Public License v3.0 | 6 votes |
private void takeSnapshot(final Scene scene) { // Take snapshot of the scene final WritableImage writableImage = scene.snapshot(null); // Write snapshot to file system as a .png image final File outFile = new File("snapshot/radialmenu-snapshot-" + snapshotCounter + ".png"); outFile.getParentFile().mkdirs(); try { ImageIO.write(SwingFXUtils.fromFXImage(writableImage, null), "png", outFile); } catch (final IOException ex) { System.out.println(ex.getMessage()); } snapshotCounter++; }
Example 3
Source File: NestDemo.java From RadialFx with GNU Lesser General Public License v3.0 | 6 votes |
private void takeSnapshot(final Scene scene) { // Take snapshot of the scene final WritableImage writableImage = scene.snapshot(null); // Write snapshot to file system as a .png image final File outFile = new File("snapshot/radialmenu-snapshot-" + snapshotCounter + ".png"); outFile.getParentFile().mkdirs(); try { ImageIO.write(SwingFXUtils.fromFXImage(writableImage, null), "png", outFile); } catch (final IOException ex) { System.out.println(ex.getMessage()); } snapshotCounter++; }
Example 4
Source File: NestNoCssDemo.java From RadialFx with GNU Lesser General Public License v3.0 | 6 votes |
private void takeSnapshot(final Scene scene) { // Take snapshot of the scene final WritableImage writableImage = scene.snapshot(null); // Write snapshot to file system as a .png image final File outFile = new File("snapshot/radialmenu-snapshot-" + snapshotCounter + ".png"); outFile.getParentFile().mkdirs(); try { ImageIO.write(SwingFXUtils.fromFXImage(writableImage, null), "png", outFile); } catch (final IOException ex) { System.out.println(ex.getMessage()); } snapshotCounter++; }
Example 5
Source File: FuturistDemo.java From RadialFx with GNU Lesser General Public License v3.0 | 6 votes |
private void takeSnapshot(final Scene scene) { // Take snapshot of the scene final WritableImage writableImage = scene.snapshot(null); // Write snapshot to file system as a .png image final File outFile = new File("snapshot/"+getClass().getSimpleName().toLowerCase()+"-" + snapshotCounter + ".png"); outFile.getParentFile().mkdirs(); try { ImageIO.write(SwingFXUtils.fromFXImage(writableImage, null), "png", outFile); } catch (final IOException ex) { System.out.println(ex.getMessage()); } snapshotCounter++; }
Example 6
Source File: RadialMovieMenuDemo.java From RadialFx with GNU Lesser General Public License v3.0 | 6 votes |
private void takeSnapshot(final Scene scene) { // Take snapshot of the scene final WritableImage writableImage = scene.snapshot(null); // Write snapshot to file system as a .png image final File outFile = new File("snapshot/radialmenu-snapshot-" + snapshotCounter + ".png"); outFile.getParentFile().mkdirs(); try { ImageIO.write(SwingFXUtils.fromFXImage(writableImage, null), "png", outFile); } catch (final IOException ex) { System.out.println(ex.getMessage()); } snapshotCounter++; }
Example 7
Source File: Dm3270Context.java From xframium-java with GNU General Public License v3.0 | 5 votes |
public void takeSnapShot(OutputStream output) { JavaFxRunnable worker = new JavaFxRunnable() { public void myWork() throws Exception { Scene scene = console.getConsoleScene(); WritableImage writableImage = new WritableImage((int)scene.getWidth(), (int)scene.getHeight()); scene.snapshot(writableImage); try { ImageIO.write(SwingFXUtils.fromFXImage(writableImage, null), "png", output); } catch (IOException ex) { log.error( "Snapshot failed with: ", ex ); } } }; Platform.runLater( worker ); worker.doWait(); }
Example 8
Source File: DrawingApp.java From FXTutorials with MIT License | 5 votes |
private void saveScreenshot(Scene scene) { WritableImage fxImage = scene.snapshot(null); BufferedImage awtImage = SwingFXUtils.fromFXImage(fxImage, null); try { ImageIO.write(awtImage, "png", new File("screenshot.png")); } catch (IOException e) { e.printStackTrace(); } }
Example 9
Source File: SpecklesView.java From narjillos with MIT License | 5 votes |
private void createBackgroundTextures() { final int tileSize = 600; // TODO: remove this duplication Group backgroundGroup = new Group(); Scene offScreenBackgroundScene = new Scene(backgroundGroup, tileSize, tileSize); Shape emptySpace = new Rectangle(0, 0, tileSize, tileSize); emptySpace.setFill(EnvironmentView.BACKGROUND_COLOR); backgroundGroup.getChildren().add(emptySpace); Group infraredBackgroundGroup = new Group(); Scene offScreenInfraredBackgroundScene = new Scene(infraredBackgroundGroup, tileSize, tileSize); Shape infraredEmptySpace = new Rectangle(0, 0, tileSize, tileSize); infraredEmptySpace.setFill(EnvironmentView.INFRARED_BACKGROUND_COLOR); infraredBackgroundGroup.getChildren().add(infraredEmptySpace); for (int i = 0; i < 5; i++) { int x = getRandomCoordinate(tileSize); int y = getRandomCoordinate(tileSize); backgroundGroup.getChildren().add(createSpeckle(x, y, NORMAL_SPECKLE_RADIUS)); infraredBackgroundGroup.getChildren().add(createSpeckle(x, y, INFRARED_SPECKLE_RADIUS)); } backgroundTexture = new WritableImage(tileSize, tileSize); offScreenBackgroundScene.snapshot(backgroundTexture); infraredBackgroundTexture = new WritableImage(tileSize, tileSize); offScreenInfraredBackgroundScene.snapshot(infraredBackgroundTexture); }