vmm.core3D
Class StereoComposite

java.lang.Object
  extended by vmm.core3D.StereoComposite

public class StereoComposite
extends java.lang.Object

This class provides support for "Anaglyph Stereo" rendering. Left- and right-eye views are drawn to separate grayscale images. Then these images are composed into a single RGB image in which the left-eye view becomes the green color component, the right-eye view becomes the red color component, and the blue color component is zero. The resulting composite image can be viewed with red/green or red/blue stereo glasses. (There should really be some way of doing all this directly in Java graphics, but support for this type of composition does not seem to exist.)


Constructor Summary
StereoComposite()
           
 
Method Summary
 void compose()
           
 int getHeight()
          Returns the image height, as specified in setSize(int, int).
 java.awt.image.BufferedImage getImage()
          Returns the BufferedImage that contains the composed view.
 java.awt.Graphics2D getLeftEyeGraphics()
          Returns a newly created graphics context for drawing into the left eye view.
 java.awt.image.BufferedImage getLeftEyeImage()
          Returns the BufferedImage where the left-eye view is rendered.
 java.awt.Graphics2D getRightEyeGraphics()
          Returns a newly created graphics context for drawing into the right eye view.
 java.awt.image.BufferedImage getRightEyeImage()
          Returns the BufferedImage where the right view is rendered.
 int getWidth()
          Returns the image width, as specified in setSize(int, int).
 void releaseMemory()
          Releases the memory allocated by setSize(int, int).
 void setSize(int width, int height)
          Sets the size of the image that is to be composed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StereoComposite

public StereoComposite()
Method Detail

setSize

public void setSize(int width,
                    int height)
Sets the size of the image that is to be composed. Buffered images are allocated for the left, right, and composed views as well as for some arrays that are used to do the compostion. This method must be called before any drawing or compositing can be done.

Parameters:
width - the width of the image
height - the height of the image

getWidth

public int getWidth()
Returns the image width, as specified in setSize(int, int). If setSize has not yet been called, the return value is 0.


getHeight

public int getHeight()
Returns the image height, as specified in setSize(int, int). If setSize has not yet been called, the return value is 0.


releaseMemory

public void releaseMemory()
Releases the memory allocated by setSize(int, int). The width and the height are also reset to 0.


getLeftEyeGraphics

public java.awt.Graphics2D getLeftEyeGraphics()
Returns a newly created graphics context for drawing into the left eye view. The setSize(int, int) method must already have been called to allocate memory for the views. If setSize has not been called, the return value is null.


getRightEyeGraphics

public java.awt.Graphics2D getRightEyeGraphics()
Returns a newly created graphics context for drawing into the right eye view. The setSize(int, int) method must already have been called to allocate memory for the views. If setSize has not been called, the return value is null.


getLeftEyeImage

public java.awt.image.BufferedImage getLeftEyeImage()
Returns the BufferedImage where the left-eye view is rendered. If setSize has not been called, the return value is null.


getRightEyeImage

public java.awt.image.BufferedImage getRightEyeImage()
Returns the BufferedImage where the right view is rendered. If setSize has not been called, the return value is null.


getImage

public java.awt.image.BufferedImage getImage()
Returns the BufferedImage that contains the composed view. Note that compose() must be called in order to combine the left- and righ-eye views into the composite image -- this is not done automatically. The return value can be null if setSize(int, int) has not been called to allocate memory.


compose

public void compose()