javax.media.j3d
Class Raster

java.lang.Object
  |
  +--javax.media.j3d.SceneGraphObject
        |
        +--javax.media.j3d.NodeComponent
              |
              +--javax.media.j3d.Geometry
                    |
                    +--javax.media.j3d.Raster

public class Raster
extends Geometry

The Raster object extends Geometry to allow drawing a raster image that is attached to a 3D location in the virtual world. It contains a point that is defined in the local object coordinate system of the Shape3D node that references the Raster. It also contains a type specifier, a reference to a ImageComponent2D object and/or a DepthComponent object, and an integer x,y offset and a size (width, height) to allow reading or writing a portion of the referenced image. In addition to being used as a type of geometry for drawing, a Raster may be used to readback pixel data (color and/or z-buffer) from the frame buffer in immediate mode.

The geometric extent of a Raster object is a single 3D point, specified by the raster position. This means that geometry-based picking or collision with a Raster object will only intersect the object at this single point; the 2D raster image is neither pickable nor collidable.


Field Summary
static int ALLOW_DEPTH_COMPONENT_READ
          Specifies that this Raster allows reading the depth component
static int ALLOW_DEPTH_COMPONENT_WRITE
          Specifies that this Raster allows writing the depth component
static int ALLOW_IMAGE_READ
          Specifies that this Raster allows reading the image
static int ALLOW_IMAGE_WRITE
          Specifies that this Raster allows writing the image
static int ALLOW_OFFSET_READ
          Specifies that this Raster allows reading the offset
static int ALLOW_OFFSET_WRITE
          Specifies that this Raster allows writing the offset
static int ALLOW_POSITION_READ
          Specifies that this Raster allows reading the position
static int ALLOW_POSITION_WRITE
          Specifies that this Raster allows writing the position
static int ALLOW_SIZE_READ
          Specifies that this Raster allows reading the size
static int ALLOW_SIZE_WRITE
          Specifies that this Raster allows writing the size
static int ALLOW_TYPE_READ
          Specifies that this Raster allows reading the type
static int RASTER_COLOR
          Specifies a Raster object with color data.
static int RASTER_COLOR_DEPTH
          Specifies a Raster object with both color and depth (z-buffer) data.
static int RASTER_DEPTH
          Specifies a Raster object with depth (z-buffer) data.
 
Fields inherited from class javax.media.j3d.Geometry
ALLOW_INTERSECT
 
Constructor Summary
Raster()
          Constructs a Raster object with default parameters.
Raster(Point3f pos, int type, int xOffset, int yOffset, int width, int height, ImageComponent2D image, DepthComponent depthComponent)
          Constructs a new Raster object with the specified values.
Raster(Point3f pos, int type, java.awt.Point offset, java.awt.Dimension size, ImageComponent2D image, DepthComponent depthComponent)
          Constructs a new Raster object with the specified values.
 
Method Summary
 NodeComponent cloneNodeComponent()
          Creates a new Raster object.
 void duplicateNodeComponent(NodeComponent originalNodeComponent)
          Copies the information found in originalNodeComponent to the current node.
 DepthComponent getDepthComponent()
          Retrieves the current depth image object.
 ImageComponent2D getImage()
          Retrieves the current pixel array object.
 void getOffset(java.awt.Point offset)
          Retrieves the current pixel offset.
 void getPosition(Point3f pos)
          Retrieves the current position in object coordinates of this raster.
 void getSize(java.awt.Dimension size)
          Retrieves the current raster size.
 int getType()
          Retrieves the current type of this raster object, one of: RASTER_COLOR, RASTER_DEPTH, or RASTER_COLOR_DEPTH.
 void setDepthComponent(DepthComponent depthComponent)
          Sets the depth image used to copy pixels to/from a Canvas3D.
 void setImage(ImageComponent2D image)
          Sets the pixel array used to copy pixels to/from a Canvas3D.
 void setOffset(int xOffset, int yOffset)
          Sets the offset within the array of pixels at which to start copying.
 void setOffset(java.awt.Point offset)
          Sets the offset within the array of pixels at which to start copying.
 void setPosition(Point3f pos)
          Sets the position in object coordinates of this raster.
 void setSize(java.awt.Dimension size)
          Sets the size of the array of pixels to be copied.
 void setSize(int width, int height)
          Sets the number of pixels to be copied from the pixel array.
 void setType(int type)
          Sets the type of this raster object to one of: RASTER_COLOR, RASTER_DEPTH, or RASTER_COLOR_DEPTH.
 
Methods inherited from class javax.media.j3d.NodeComponent
getDuplicateOnCloneTree, setDuplicateOnCloneTree
 
Methods inherited from class javax.media.j3d.SceneGraphObject
clearCapability, duplicateSceneGraphObject, getCapability, getUserData, isCompiled, isLive, setCapability, setUserData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RASTER_COLOR

public static final int RASTER_COLOR
Specifies a Raster object with color data. In this mode, the image reference must point to a valid ImageComponent object.

RASTER_DEPTH

public static final int RASTER_DEPTH
Specifies a Raster object with depth (z-buffer) data. In this mode, the depthImage reference must point to a valid DepthComponent object.

RASTER_COLOR_DEPTH

public static final int RASTER_COLOR_DEPTH
Specifies a Raster object with both color and depth (z-buffer) data. In this mode, the image reference must point to a valid ImageComponent object, and the depthImage reference must point to a valid DepthComponent object.

ALLOW_POSITION_READ

public static final int ALLOW_POSITION_READ
Specifies that this Raster allows reading the position

ALLOW_POSITION_WRITE

public static final int ALLOW_POSITION_WRITE
Specifies that this Raster allows writing the position

ALLOW_OFFSET_READ

public static final int ALLOW_OFFSET_READ
Specifies that this Raster allows reading the offset

ALLOW_OFFSET_WRITE

public static final int ALLOW_OFFSET_WRITE
Specifies that this Raster allows writing the offset

ALLOW_IMAGE_READ

public static final int ALLOW_IMAGE_READ
Specifies that this Raster allows reading the image

ALLOW_IMAGE_WRITE

public static final int ALLOW_IMAGE_WRITE
Specifies that this Raster allows writing the image

ALLOW_DEPTH_COMPONENT_READ

public static final int ALLOW_DEPTH_COMPONENT_READ
Specifies that this Raster allows reading the depth component

ALLOW_DEPTH_COMPONENT_WRITE

public static final int ALLOW_DEPTH_COMPONENT_WRITE
Specifies that this Raster allows writing the depth component

ALLOW_SIZE_READ

public static final int ALLOW_SIZE_READ
Specifies that this Raster allows reading the size

ALLOW_SIZE_WRITE

public static final int ALLOW_SIZE_WRITE
Specifies that this Raster allows writing the size

ALLOW_TYPE_READ

public static final int ALLOW_TYPE_READ
Specifies that this Raster allows reading the type
Constructor Detail

Raster

public Raster()
Constructs a Raster object with default parameters. The default values are as follows:

Raster

public Raster(Point3f pos,
              int type,
              int xOffset,
              int yOffset,
              int width,
              int height,
              ImageComponent2D image,
              DepthComponent depthComponent)
Constructs a new Raster object with the specified values.
Parameters:
pos - the position in object coordinates of the upper-left corner of the raster
type - the type of raster object, one of: RASTER_COLOR, RASTER_DEPTH, or RASTER_COLOR_DEPTH.
xOffset - the x offset within the array of pixels at which to start copying
yOffset - the y offset within the array of pixels at which to start copying
width - the number of columns of pixels to copy
height - the number of rows of pixels to copy
image - the ImageComponent2D object containing the color data
depthImage - the DepthComponent object containing the depth (z-buffer) data

Raster

public Raster(Point3f pos,
              int type,
              java.awt.Point offset,
              java.awt.Dimension size,
              ImageComponent2D image,
              DepthComponent depthComponent)
Constructs a new Raster object with the specified values.
Parameters:
pos - the position in object coordinates of the upper-left corner of the raster
type - the type of raster object, one of: RASTER_COLOR, RASTER_DEPTH, or RASTER_COLOR_DEPTH.
offset - the offset within the array of pixels at which to start copying
size - the width and height of the image to be copied
image - the ImageComponent2D object containing the color data
depthImage - the DepthComponent object containing the depth (z-buffer) data
Method Detail

setPosition

public void setPosition(Point3f pos)
Sets the position in object coordinates of this raster. This position is transformed into device coordinates and is used as the upper-left corner of the raster.
Parameters:
pos - the new position of this raster
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

getPosition

public void getPosition(Point3f pos)
Retrieves the current position in object coordinates of this raster.
Parameters:
pos - the vector that will receive the current position
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

setType

public void setType(int type)
Sets the type of this raster object to one of: RASTER_COLOR, RASTER_DEPTH, or RASTER_COLOR_DEPTH.
Parameters:
type - the new type of this raster
Throws:
RestrictedAccessException - if the method is called when this object is part of live or compiled scene graph.

getType

public int getType()
Retrieves the current type of this raster object, one of: RASTER_COLOR, RASTER_DEPTH, or RASTER_COLOR_DEPTH.
Returns:
type the type of this raster
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

setOffset

public void setOffset(int xOffset,
                      int yOffset)
Sets the offset within the array of pixels at which to start copying.
Parameters:
xOffset - the x offset within the array of pixels at which to start copying
yOffset - the y offset within the array of pixels at which to start copying
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

setOffset

public void setOffset(java.awt.Point offset)
Sets the offset within the array of pixels at which to start copying.
Parameters:
offset - the new pixel offset
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

getOffset

public void getOffset(java.awt.Point offset)
Retrieves the current pixel offset.
Parameters:
offset - the object that will receive the offset
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

setSize

public void setSize(int width,
                    int height)
Sets the number of pixels to be copied from the pixel array.
Parameters:
width - the number of columns in the array of pixels to copy
height - the number of rows in the array of pixels to copy
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

setSize

public void setSize(java.awt.Dimension size)
Sets the size of the array of pixels to be copied.
Parameters:
size - the new size
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

getSize

public void getSize(java.awt.Dimension size)
Retrieves the current raster size.
Parameters:
size - the object that will receive the size
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

setImage

public void setImage(ImageComponent2D image)
Sets the pixel array used to copy pixels to/from a Canvas3D. This is used when the type is RASTER_COLOR or RASTER_COLOR_DEPTH.
Parameters:
image - the ImageComponent2D object containing the color data
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

getImage

public ImageComponent2D getImage()
Retrieves the current pixel array object.
Returns:
image the ImageComponent2D object containing the color data
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

setDepthComponent

public void setDepthComponent(DepthComponent depthComponent)
Sets the depth image used to copy pixels to/from a Canvas3D. This is used when the type is RASTER_DEPTH or RASTER_COLOR_DEPTH.
Parameters:
depthImage - the DepthComponent object containing the depth (z-buffer) data
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

getDepthComponent

public DepthComponent getDepthComponent()
Retrieves the current depth image object.
Returns:
depthImage DepthComponent containing the depth (z-buffer) data
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

cloneNodeComponent

public NodeComponent cloneNodeComponent()
Creates a new Raster object. Called from a Leaf node's duplicateNode method.
Overrides:
cloneNodeComponent in class NodeComponent
Returns:
a duplicate of the Raster object.
See Also:
Node.duplicateNode(javax.media.j3d.Node, boolean), Node.cloneTree(), NodeComponent.setDuplicateOnCloneTree(boolean)

duplicateNodeComponent

public void duplicateNodeComponent(NodeComponent originalNodeComponent)
Copies the information found in originalNodeComponent to the current node. This routine is called as part of the cloneNodeComponent operation.
Overrides:
duplicateNodeComponent in class NodeComponent
Parameters:
originalNodeComponent - the node to duplicate.
See Also:
Node.cloneTree(), Node.cloneNode(boolean), NodeComponent.cloneNodeComponent(), NodeComponent.setDuplicateOnCloneTree(boolean)