JDK-8101040 : Render to image (snapshot) support
  • Type: Enhancement
  • Component: javafx
  • Sub-Component: graphics
  • Affected Version: fx2.0
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2011-10-13
  • Updated: 2015-06-16
  • Resolved: 2012-05-16
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7u6Fixed
Related Reports
Blocks :  
Blocks :  
Blocks :  
Blocks :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Description
In 2.0 we added nonpublic "@treatasprivate" API to to the following:

1) Render a scene to an (opaque) platform image
2) Create an Image object from a platform image
3) Convert a JavaFX Image object to a BufferedImage
4) Convert a BufferedImage to a JavaFX Image object

We need to formalize this API and implement it in such a way that the core JavaFX module doesn't include a reliance on Swing / AWT / Java2D.

We also need to decide whether any additional image operations are needed, for example, the ability to update a sub-image has been requested.
Comments
verified in b14
26-06-2012

Hi, did an Swing/AWT independant API method make its way to the JavaFX 2.2 public API ?
23-06-2012

Added unit tests in rt-closed/tests/image/SnapshotTests/ as follows. Unit Tests: javafx/scene/Snapshot1Test javafx/scene/Snapshot2Test
02-06-2012

http://hg.openjdk.java.net/openjfx/2.2/graphics/rt/rev/325e41f5abce http://jfxsrc.us.oracle.com/javafx/2.2/scrum/graphics/rt-closed/rev/62f055e98d7f
16-05-2012

http://jfxsrc.us.oracle.com/javafx/2.2/scrum/graphics/rt/rev/325e41f5abce http://jfxsrc.us.oracle.com/javafx/2.2/scrum/graphics/rt-closed/rev/62f055e98d7f
15-05-2012

The current proposal is to add the following methods on the existing Node and Scene class, along with two new classes to hold the parameters and the result, respectively. Scene: public Image snapshot(Image image) public void snapshot(Callback<SnapshotResult,Void> callback, Image image) Node: public Image snapshot(SnapshotParameters params, Image image) public void snapshot(Callback<SnapshotResult,Void> callback, SnapshotParameters params, Image image) // Data container class with the following attributes SnapshotParameters: get/setDepthBuffer(boolean) get/setCamera(Camera) get/setTransform(Transform); get/setFill(Paint); get/setViewport(Rectangle2D) // Data container class to return the result of an async snapshot, currently immutable SnapshotResult: Image image Object source SnapshotParameters params
12-05-2012

Here are the raw notes on render-to-image from a meeting we had to scope out the desired functionality (not the final API). API --- Scene { void shapshot(Callback<Image>); void shapshot(Callback<Image>, Image); } Node { void shapshot(SnapshotParams, Callback<Image>); void shapshot(SnapshotParams, Callback<Image>, Image); } public class javafx.scene.SnapshotParams { // TBD but need camera, fill, etc. } QUESTIONS: 4) "SnapshotParams" (name?) will encapsulate various rendering properties (e.g., Camera, depth buffer, background fill, transform?)
26-03-2012

Note that the conversion methods to/from BufferedImage are tracked in RT-17409
26-03-2012

@Pavel: yes this should be possible with the API
26-03-2012

For drag view feature (image floating with mouse cursor, representing the data during a drag-and-drop operation - RT-14730) we need to render a specific node (with its children) into an image. Is that in scope of this issue? For this particular use-case we would also need a way to make the image fade out (by increasing transparency) at its edges, would that be in scope of this issue?
01-03-2012

Will work with SQE to baseline this by 3/9/2012.
04-02-2012

We need to clearly define the requirements for the 2.2 release.
19-01-2012

Bump priority to match that of the PRD item
19-01-2012

Implements A360 Feature http://oracleplan.oracle.com/gotoEntity?entityType=FEATURE&entityId=708329
19-01-2012

2.2
13-10-2011