public WritableImage snapshot (WritableImage image)

Takes a snapshot of this scene and returns the rendered image when it 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.

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.

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.

Returns:  the rendered image

IllegalStateException    if this method is called on a thread other than the JavaFX Application Thread.

Since:  JavaFX 2.2