JDK-8100746 : Add capability to render a node or scene into a Graphics2D context.
  • Type: Enhancement
  • Component: javafx
  • Sub-Component: graphics
  • Affected Version: fx2.0
  • Priority: P3
  • Status: Resolved
  • Resolution: Duplicate
  • Submitted: 2011-06-06
  • Updated: 2015-06-16
  • Resolved: 2012-04-05
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Description
Several people, me included, have asked for printing and rendering into images support. Looking closer at the issue I think it might be worthwile to generalize this and add support to render a node or scene into a Graphics2D context. If I understand the JavaFX architecture correctly there is a fallback to Java2D if Prism does not work. If this is true, the implementation of the above request should be easy. The background to this request is the following:
I have implemented an Applet to create QR code labels based on Swing and Java2D. The nice thing about this is that I can reuse the rendering code for three different purposes. I can use it for the movable and zoomable preview on the screen, for directly printing and for rendering into a PDF-file via the Graphics2D context of the iText library. With presidio it is not possible to implement this functionality at all and if there is only support for rendering into images in the future, this will not be such an elegant solution as it is now. This is espacially true if you consider that a vector graphic looks much better when scaled than a bitmap.
Comments
With the planned render-to-image and image-ops features of 2.2, this should be possible using public API. Although we will not directly expose rendering into a Java2D graphics content, it will be possible to render into a JavaFX image and copy that to a BufferedImage (or directly get the pixels out of the FX image). Likewise it will be possible to take a BufferedImage and copy that into an FX image.
05-04-2012