NCSA Portfolio

ncsa.j3d.ui.record
Class RecordableCanvas3D

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Canvas
              |
              +--javax.media.j3d.Canvas3D
                    |
                    +--ncsa.j3d.ui.record.RecordableCanvas3D

public class RecordableCanvas3D
extends javax.media.j3d.Canvas3D
implements RendezvousInterface

RecordableCanvas3D can be used to dump JPEG files of the canvas contents. The image dump occurs during the postSwap() method call and is done automatically in Java 3D. By default, files are dumped into a directory called "frames", and have a prefix of "image" with the frame number as the suffix.

This is meant to be used as a drop-in replacement for Canvas3D.

See Also:
Serialized Form

Fields inherited from class javax.media.j3d.Canvas3D
FIELD_ALL, FIELD_LEFT, FIELD_RIGHT
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
RecordableCanvas3D(java.awt.GraphicsConfiguration graphicsConfiguration)
          Constructs and initializes a new RecordableCanvas3D object that Java 3D can render into.
RecordableCanvas3D(java.awt.GraphicsConfiguration graphicsConfiguration, boolean bRepaint)
          Constructs and initializes a new RecordableCanvas3D object that Java 3D can render into.
 
Method Summary
 void allocImage()
          Allocates the image based on the width and height of the canvas, or the size specified by setImageSize.
 void captureInPostRender(boolean b)
          Sets a flag about whether to do capturing in postRender instead of in postSwap.
 java.lang.String getDirectoryName()
          Returns the directory name where files will written
 java.lang.String getFilePrefix()
          Returns the file name prefix
 void Notify()
          notifies the people who have called rendezvous
 void postRender()
          This routine is called by Java 3D automatically after completing all rendering to the canvas, but before the buffer swap.
 void postSwap()
          This routine is called by Java 3D automatically after completing all rendering to the canvas, following the buffer swap.
 void rendezvous()
          This is used by the Record/Replay scripting mechanisms to prevent transformations from being updated during the time it takes to write files.
 void setDirectoryName(java.lang.String dir)
          Sets the directory name to write to
 void setFilePrefix(java.lang.String prefix)
          Sets the file name prefix
 void startRecording()
          Start dumping frames on the next call to postSwap()
 void stopRecording()
          turns recording off
 void takeSnapshot()
          Dump a single frame on the next call to postSwap(), using the default filename
 void takeSnapshot(java.lang.String filename)
          Dump a single frame on the next call to postSwap(), using the given filename
 void writeImage(java.lang.String imagename, java.awt.image.BufferedImage image)
          Writes a JPEG file for the specified BufferedImage
 
Methods inherited from class javax.media.j3d.Canvas3D
addNotify, getCenterEyeInImagePlate, getDoubleBufferAvailable, getDoubleBufferEnable, getGraphicsContext3D, getImagePlateToVworld, getLeftEyeInImagePlate, getLeftManualEyeInImagePlate, getPhysicalHeight, getPhysicalWidth, getPixelLocationInImagePlate, getRightEyeInImagePlate, getRightManualEyeInImagePlate, getSceneAntialiasingAvailable, getScreen3D, getStereoAvailable, getStereoEnable, getView, getVworldToImagePlate, paint, preRender, removeNotify, renderField, setDoubleBufferEnable, setLeftEyeInImagePlate, setLeftManualEyeInImagePlate, setRightEyeInImagePlate, setRightManualEyeInImagePlate, setStereoEnable, startRenderer, stopRenderer, swap
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getParent, getPeer, getPreferredSize, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, update, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RecordableCanvas3D

public RecordableCanvas3D(java.awt.GraphicsConfiguration graphicsConfiguration)
Constructs and initializes a new RecordableCanvas3D object that Java 3D can render into.
Parameters:
graphicsConfiguration - a valid GraphicsConfiguration object which will be used to create the canvas

RecordableCanvas3D

public RecordableCanvas3D(java.awt.GraphicsConfiguration graphicsConfiguration,
                          boolean bRepaint)
Constructs and initializes a new RecordableCanvas3D object that Java 3D can render into.
Parameters:
graphicsConfiguration - a valid GraphicsConfiguration object which will be used to create the canvas
bRepaint - set to false to prevent repainting during snapshots
Method Detail

captureInPostRender

public void captureInPostRender(boolean b)
Sets a flag about whether to do capturing in postRender instead of in postSwap. Set to "true" if you want to capture in postRender().

setDirectoryName

public void setDirectoryName(java.lang.String dir)
Sets the directory name to write to

getDirectoryName

public java.lang.String getDirectoryName()
Returns the directory name where files will written

setFilePrefix

public void setFilePrefix(java.lang.String prefix)
Sets the file name prefix

getFilePrefix

public java.lang.String getFilePrefix()
Returns the file name prefix

allocImage

public void allocImage()
Allocates the image based on the width and height of the canvas, or the size specified by setImageSize.

startRecording

public void startRecording()
Start dumping frames on the next call to postSwap()

takeSnapshot

public void takeSnapshot(java.lang.String filename)
Dump a single frame on the next call to postSwap(), using the given filename

takeSnapshot

public void takeSnapshot()
Dump a single frame on the next call to postSwap(), using the default filename

postSwap

public void postSwap()
This routine is called by Java 3D automatically after completing all rendering to the canvas, following the buffer swap. If recording is turned on, methods to dump the current frame are called.
Overrides:
postSwap in class javax.media.j3d.Canvas3D

postRender

public void postRender()
This routine is called by Java 3D automatically after completing all rendering to the canvas, but before the buffer swap. If recording is turned on, methods to dump the current frame are called, if captureInPostRender() was previously called with the value true.
Overrides:
postRender in class javax.media.j3d.Canvas3D

writeImage

public void writeImage(java.lang.String imagename,
                       java.awt.image.BufferedImage image)
Writes a JPEG file for the specified BufferedImage
Parameters:
filename - the file name to write to
image - the BufferedImage to write as a JPEG file

rendezvous

public void rendezvous()
This is used by the Record/Replay scripting mechanisms to prevent transformations from being updated during the time it takes to write files.
Specified by:
rendezvous in interface RendezvousInterface
Tags copied from interface: RendezvousInterface
Parameters:
none -  

stopRecording

public void stopRecording()
turns recording off

Notify

public void Notify()
notifies the people who have called rendezvous

NCSA Portfolio

NCSA Portfolio, Copyright 1997-1999, National Center for Supercomputing Applications, University of Illinois Urbana-Champaign, All Rights Reserved