Package javax.media.j3d
Class Raster
java.lang.Object
javax.media.j3d.SceneGraphObject
javax.media.j3d.NodeComponent
javax.media.j3d.Geometry
javax.media.j3d.Raster
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 3D 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 clipping mode, a reference to
a ImageComponent2D object and/or a DepthComponent object, an
integer x,y source offset and a size (width, height) to allow
reading or writing a portion of the referenced image, and an
integer x,y destination offset to position the raster relative to
the transformed 3D point.
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
FieldsModifier and TypeFieldDescriptionstatic final int
Specifies that this Raster allows reading the clip mode.static final int
Specifies that this Raster allows writing the clip mode.static final int
Specifies that this Raster allows reading the depth component.static final int
Specifies that this Raster allows writing the depth component.static final int
Specifies that this Raster allows reading the image.static final int
Specifies that this Raster allows writing the image.static final int
Specifies that this Raster allows reading the source or destination offset.static final int
Specifies that this Raster allows writing the source or destination offset.static final int
Specifies that this Raster allows reading the position.static final int
Specifies that this Raster allows writing the position.static final int
Specifies that this Raster allows reading the size.static final int
Specifies that this Raster allows writing the size.static final int
Specifies that this Raster allows reading the type.static final int
Specifies that the raster object is clipped as an image after the raster position has been transformed.static final int
Specifies that this raster object is not drawn if the raster position is outside the viewing volume.static final int
Specifies a Raster object with color data.static final int
Specifies a Raster object with both color and depth (z-buffer) data.static final int
Specifies a Raster object with depth (z-buffer) data.Fields inherited from class javax.media.j3d.Geometry
ALLOW_INTERSECT
-
Constructor Summary
ConstructorsConstructorDescriptionRaster()
Constructs a Raster object with default parameters.Raster
(javax.vecmath.Point3f pos, int type, int xSrcOffset, int ySrcOffset, int width, int height, ImageComponent2D image, DepthComponent depthComponent) Constructs a new Raster object with the specified values.Raster
(javax.vecmath.Point3f pos, int type, int clipMode, Point srcOffset, Dimension size, Point dstOffset, ImageComponent2D image, DepthComponent depthComponent) Constructs a new Raster object with the specified values.Raster
(javax.vecmath.Point3f pos, int type, Point srcOffset, Dimension size, ImageComponent2D image, DepthComponent depthComponent) Constructs a new Raster object with the specified values. -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.replaced with cloneNodeComponent(boolean forceDuplicate)void
duplicateNodeComponent
(NodeComponent originalNodeComponent) Deprecated.replaced with duplicateNodeComponent( NodeComponent originalNodeComponent, boolean forceDuplicate)int
Retrieves the current clipping mode of this raster object.Retrieves the current depth image object.void
getDstOffset
(Point dstOffset) Retrieves the current destination pixel offset.getImage()
Retrieves the current pixel array object.void
Deprecated.As of Java 3D version 1.3, replaced bygetSrcOffset(java.awt.Point)
void
getPosition
(javax.vecmath.Point3f pos) Retrieves the current position in object coordinates of this raster.void
Retrieves the current raster size.void
getSrcOffset
(Point srcOffset) Retrieves the current source pixel offset.int
getType()
Retrieves the current type of this raster object, one of: RASTER_COLOR, RASTER_DEPTH, or RASTER_COLOR_DEPTH.void
setClipMode
(int clipMode) Sets the clipping mode of this raster object.void
setDepthComponent
(DepthComponent depthComponent) Sets the depth image used to copy pixels to/from a Canvas3D.void
setDstOffset
(int xDstOffset, int yDstOffset) Sets the destination pixel offset of the upper-left corner of the rendered image relative to the transformed position.void
setDstOffset
(Point dstOffset) Sets the destination pixel offset of the upper-left corner of the rendered image relative to the transformed position.void
setImage
(ImageComponent2D image) Sets the pixel array used to copy pixels to/from a Canvas3D.void
setOffset
(int xSrcOffset, int ySrcOffset) Deprecated.As of Java 3D version 1.3, replaced bysetSrcOffset(int,int)
void
Deprecated.As of Java 3D version 1.3, replaced bysetSrcOffset(java.awt.Point)
void
setPosition
(javax.vecmath.Point3f pos) Sets the position in object coordinates of this raster.void
setSize
(int width, int height) Sets the number of pixels to be copied from the pixel array.void
Sets the size of the array of pixels to be copied.void
setSrcOffset
(int xSrcOffset, int ySrcOffset) Sets the offset within the source array of pixels at which to start copying.void
setSrcOffset
(Point srcOffset) Sets the offset within the source array of pixels at which to start copying.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
cloneNodeComponent, duplicateNodeComponent, getDuplicateOnCloneTree, setDuplicateOnCloneTree
Methods inherited from class javax.media.j3d.SceneGraphObject
clearCapability, clearCapabilityIsFrequent, duplicateSceneGraphObject, getCapability, getCapabilityIsFrequent, getName, getUserData, isCompiled, isLive, setCapability, setCapabilityIsFrequent, setName, setUserData, toString, updateNodeReferences
-
Field Details
-
RASTER_COLOR
Specifies a Raster object with color data. In this mode, the image reference must point to a valid ImageComponent object.- See Also:
-
RASTER_DEPTH
Specifies a Raster object with depth (z-buffer) data. In this mode, the depthImage reference must point to a valid DepthComponent object.- See Also:
-
RASTER_COLOR_DEPTH
public static final int RASTER_COLOR_DEPTHSpecifies 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.- See Also:
-
CLIP_POSITION
public static final int CLIP_POSITIONSpecifies that this raster object is not drawn if the raster position is outside the viewing volume. In this mode, the raster is not drawn when the transformed raster position is clipped out, even if part of the raster would have been visible. This is the default mode.- Since:
- Java 3D 1.3
- See Also:
-
CLIP_IMAGE
public static final int CLIP_IMAGESpecifies that the raster object is clipped as an image after the raster position has been transformed. In this mode, part of the raster may be drawn even when the transformed raster position is clipped out.- Since:
- Java 3D 1.3
- See Also:
-
ALLOW_POSITION_READ
public static final int ALLOW_POSITION_READSpecifies that this Raster allows reading the position.- See Also:
-
ALLOW_POSITION_WRITE
public static final int ALLOW_POSITION_WRITESpecifies that this Raster allows writing the position.- See Also:
-
ALLOW_OFFSET_READ
public static final int ALLOW_OFFSET_READSpecifies that this Raster allows reading the source or destination offset.- See Also:
-
ALLOW_OFFSET_WRITE
public static final int ALLOW_OFFSET_WRITESpecifies that this Raster allows writing the source or destination offset.- See Also:
-
ALLOW_IMAGE_READ
public static final int ALLOW_IMAGE_READSpecifies that this Raster allows reading the image.- See Also:
-
ALLOW_IMAGE_WRITE
public static final int ALLOW_IMAGE_WRITESpecifies that this Raster allows writing the image.- See Also:
-
ALLOW_DEPTH_COMPONENT_READ
public static final int ALLOW_DEPTH_COMPONENT_READSpecifies that this Raster allows reading the depth component.- See Also:
-
ALLOW_DEPTH_COMPONENT_WRITE
public static final int ALLOW_DEPTH_COMPONENT_WRITESpecifies that this Raster allows writing the depth component.- See Also:
-
ALLOW_SIZE_READ
public static final int ALLOW_SIZE_READSpecifies that this Raster allows reading the size.- See Also:
-
ALLOW_SIZE_WRITE
public static final int ALLOW_SIZE_WRITESpecifies that this Raster allows writing the size.- See Also:
-
ALLOW_TYPE_READ
public static final int ALLOW_TYPE_READSpecifies that this Raster allows reading the type.- See Also:
-
ALLOW_CLIP_MODE_READ
public static final int ALLOW_CLIP_MODE_READSpecifies that this Raster allows reading the clip mode.- Since:
- Java 3D 1.3
- See Also:
-
ALLOW_CLIP_MODE_WRITE
public static final int ALLOW_CLIP_MODE_WRITESpecifies that this Raster allows writing the clip mode.- Since:
- Java 3D 1.3
- See Also:
-
-
Constructor Details
-
Raster
public Raster()Constructs a Raster object with default parameters. The default values are as follows:-
type : RASTER_COLOR
clipMode : CLIP_POSITION
position : (0,0,0)
srcOffset : (0,0)
size : (0,0)
dstOffset : (0,0)
image : null
depth component : null
-
Raster
public Raster(javax.vecmath.Point3f pos, int type, int xSrcOffset, int ySrcOffset, 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 rastertype
- the type of raster object, one of: RASTER_COLOR, RASTER_DEPTH, or RASTER_COLOR_DEPTHxSrcOffset
- the x offset within the source array of pixels at which to start copyingySrcOffset
- the y offset within the source array of pixels at which to start copyingwidth
- the number of columns of pixels to copyheight
- the number of rows of pixels to copyimage
- the ImageComponent2D object containing the color datadepthComponent
- the DepthComponent object containing the depth (z-buffer) data- Throws:
IllegalArgumentException
- if the image class of the specified ImageComponent2D is ImageClass.NIO_IMAGE_BUFFER.
-
Raster
public Raster(javax.vecmath.Point3f pos, int type, Point srcOffset, 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 rastertype
- the type of raster object, one of: RASTER_COLOR, RASTER_DEPTH, or RASTER_COLOR_DEPTHsrcOffset
- the offset within the source array of pixels at which to start copyingsize
- the width and height of the image to be copiedimage
- the ImageComponent2D object containing the color datadepthComponent
- the DepthComponent object containing the depth (z-buffer) data- Throws:
IllegalArgumentException
- if the image class of the specified ImageComponent2D is ImageClass.NIO_IMAGE_BUFFER.
-
Raster
public Raster(javax.vecmath.Point3f pos, int type, int clipMode, Point srcOffset, Dimension size, Point dstOffset, 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 rastertype
- the type of raster object, one of: RASTER_COLOR, RASTER_DEPTH, or RASTER_COLOR_DEPTHclipMode
- the clipping mode of the raster object, one of: CLIP_POSITION or CLIP_IMAGEsrcOffset
- the offset within the source array of pixels at which to start copyingsize
- the width and height of the image to be copieddstOffset
- the destination pixel offset of the upper-left corner of the rendered image relative to the transformed positionimage
- the ImageComponent2D object containing the color datadepthComponent
- the DepthComponent object containing the depth (z-buffer) data- Throws:
IllegalArgumentException
- if the image class of the specified ImageComponent2D is ImageClass.NIO_IMAGE_BUFFER.- Since:
- Java 3D 1.3
-
-
Method Details
-
setPosition
public void setPosition(javax.vecmath.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(javax.vecmath.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
-
setClipMode
public void setClipMode(int clipMode) Sets the clipping mode of this raster object.- Parameters:
clipMode
- the new clipping mode of this raster, one of: CLIP_POSITION or CLIP_IMAGE. The default mode is CLIP_POSITION.- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph- Since:
- Java 3D 1.3
-
getClipMode
public int getClipMode()Retrieves the current clipping mode of this raster object.- Returns:
- clipMode the clipping mode of this raster, one of: CLIP_POSITION or CLIP_IMAGE.
- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph- Since:
- Java 3D 1.3
-
setOffset
public void setOffset(int xSrcOffset, int ySrcOffset) Deprecated.As of Java 3D version 1.3, replaced bysetSrcOffset(int,int)
-
setOffset
Deprecated.As of Java 3D version 1.3, replaced bysetSrcOffset(java.awt.Point)
-
getOffset
Deprecated.As of Java 3D version 1.3, replaced bygetSrcOffset(java.awt.Point)
-
setSrcOffset
public void setSrcOffset(int xSrcOffset, int ySrcOffset) Sets the offset within the source array of pixels at which to start copying.- Parameters:
xSrcOffset
- the x offset within the source array of pixels at which to start copyingySrcOffset
- the y offset within the source 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- Since:
- Java 3D 1.3
-
setSrcOffset
Sets the offset within the source array of pixels at which to start copying.- Parameters:
srcOffset
- the new source pixel offset- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph- Since:
- Java 3D 1.3
-
getSrcOffset
Retrieves the current source pixel offset.- Parameters:
srcOffset
- the object that will receive the source offset- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph- Since:
- Java 3D 1.3
-
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 copyheight
- 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
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
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
-
setDstOffset
public void setDstOffset(int xDstOffset, int yDstOffset) Sets the destination pixel offset of the upper-left corner of the rendered image relative to the transformed position. This pixel offset is added to the transformed raster position prior to rendering the image.- Parameters:
xDstOffset
- the x coordinate of the new offsetyDstOffset
- the y coordinate of the new offset- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph- Since:
- Java 3D 1.3
-
setDstOffset
Sets the destination pixel offset of the upper-left corner of the rendered image relative to the transformed position. This pixel offset is added to the transformed raster position prior to rendering the image.- Parameters:
dstOffset
- the new destination pixel offset- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph- Since:
- Java 3D 1.3
-
getDstOffset
Retrieves the current destination pixel offset.- Parameters:
dstOffset
- the object that will receive the destination offset- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graph- Since:
- Java 3D 1.3
-
setImage
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 graphIllegalSharingException
- if this Raster is live and the specified image is being used by a Canvas3D as an off-screen buffer.IllegalArgumentException
- if the image class of the specified ImageComponent2D is ImageClass.NIO_IMAGE_BUFFER.
-
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
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:
depthComponent
- 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
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
Deprecated.replaced with cloneNodeComponent(boolean forceDuplicate)- Overrides:
cloneNodeComponent
in classNodeComponent
-
duplicateNodeComponent
Deprecated.replaced with duplicateNodeComponent( NodeComponent originalNodeComponent, boolean forceDuplicate)NOTE: Applications should not call this method directly. It should only be called by the cloneNode method.- Overrides:
duplicateNodeComponent
in classNodeComponent
-