public void snapshot (Callback<SnapshotResult, Void> callback, WritableImage image)

Takes a snapshot of this scene at the next frame and calls the specified callback method when the image is ready. CSS and layout processing will be done for the scene prior to rendering it. The entire destination image is cleared using the fill Paint of this scene. The nodes in the scene are then rendered to the image. The point (0,0) in scene coordinates is mapped to (0,0) in the image. If the image is smaller than the size of the scene, then the rendering will be clipped by the image.

This is an asynchronous call, which means that other events or animation might be processed before the scene is rendered. If any such events modify a node in the scene that modification will be reflected in the rendered image (as it will also be reflected in the frame rendered to the Stage).

When taking a snapshot of a scene that is being animated, either explicitly by the application or implicitly (such as chart animation), the snapshot will be rendered based on the state of the scene graph at the moment the snapshot is taken and will not reflect any subsequent animation changes.

Parameters:
callback    a class whose call method will be called when the image is ready. The SnapshotResult that is passed into the call method of the callback will contain the rendered image and the source scene that was rendered. The callback parameter must not be null.
image    the writable image that will be used to hold the rendered scene. It may be null in which case a new WritableImage will be constructed. If the image is non-null, the scene will be rendered into the existing image. In this case, the width and height of the image determine the area that is rendered instead of the width and height of the scene.

Exceptions:
IllegalStateException    if this method is called on a thread other than the JavaFX Application Thread.
NullPointerException    if the callback parameter is null.

Since:  JavaFX 2.2