Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 

Re: Rendering an offscreen image

I have implemented offscreen rendering in Java2D, and image
capture for both Java2D and Java3D.  See examples/DisplayTest.java
cases 50-52 for examples of how to code these functions.  Note
also that offscreen rendering is currently not possible with
Java3D - but that capability is promised for Java3D version 1.2.
 
The constructor:
 
  DisplayImplJ2D(String name, int width, int height)
 
creates a DisplayImplJ2D for offscreen rendering.  Note that
its getComponent() returns null.
 
The method:
 
  BufferedImage DisplayImpl.getImage()
 
returns a BufferedImage captured from the display, for either
Java2D or Java3D.  You can read pixels from it, and use it to
write image files.
 
Good luck, and please let me know if you have any problems with
these.
 
Cheers,
Bill
----------------------------------------------------------
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
whibbard@xxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738
http://www.ssec.wisc.edu/~billh/vis.html
 
"kill cross-platform Java by growing the polluted Java market"
   - from an internal Microsoft planning document
 

 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Community Programs   Unidata is a member of the UCAR Community Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690