javafx.scene.Scene#snapshot ( )源码实例Demo

下面列出了javafx.scene.Scene#snapshot ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: RadialFx   文件: RadialColorMenuDemo.java
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++;
   }
 
源代码2 项目: RadialFx   文件: RadialSettingsMenuDemo.java
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++;
   }
 
源代码3 项目: RadialFx   文件: NestDemo.java
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++;
   }
 
源代码4 项目: RadialFx   文件: NestNoCssDemo.java
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++;
   }
 
源代码5 项目: RadialFx   文件: FuturistDemo.java
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++;
   }
 
源代码6 项目: RadialFx   文件: RadialMovieMenuDemo.java
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++;
   }
 
源代码7 项目: xframium-java   文件: Dm3270Context.java
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();
}
 
源代码8 项目: FXTutorials   文件: DrawingApp.java
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();
    }
}
 
源代码9 项目: narjillos   文件: SpecklesView.java
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);
}