javax.media.j3d
Class ImageComponent2D

java.lang.Object
  |
  +--javax.media.j3d.SceneGraphObject
        |
        +--javax.media.j3d.NodeComponent
              |
              +--javax.media.j3d.ImageComponent
                    |
                    +--javax.media.j3d.ImageComponent2D

public class ImageComponent2D
extends ImageComponent

This class defines a 2D image component. This is used for texture images, background images and raster components of Shape3D nodes.


Fields inherited from class javax.media.j3d.ImageComponent
ALLOW_FORMAT_READ, ALLOW_IMAGE_READ, ALLOW_SIZE_READ, FORMAT_CHANNEL8, FORMAT_LUM4_ALPHA4, FORMAT_LUM8_ALPHA8, FORMAT_R3_G3_B2, FORMAT_RGB, FORMAT_RGB4, FORMAT_RGB5, FORMAT_RGB5_A1, FORMAT_RGB8, FORMAT_RGBA, FORMAT_RGBA4, FORMAT_RGBA8
 
Constructor Summary
ImageComponent2D(int format, java.awt.image.BufferedImage image)
          Constructs an 2D image component object using the specified format, and BufferedImage.
ImageComponent2D(int format, int width, int height)
          Constructs an 2D image component object using the specified format, width and height.
 
Method Summary
 NodeComponent cloneNodeComponent()
          Creates a new ImageComponent2D object.
 void duplicateNodeComponent(NodeComponent originalNodeComponent)
          Copies the information found in originalNodeComponent to the current node.
 java.awt.image.BufferedImage getImage()
          Retrieves a copy of the image in this ImageComponent2D object.
 void set(java.awt.image.BufferedImage image)
          Copies the specified BufferedImage to this 2D image component object.
 
Methods inherited from class javax.media.j3d.ImageComponent
getFormat, getHeight, getWidth
 
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
 

Constructor Detail

ImageComponent2D

public ImageComponent2D(int format,
                        int width,
                        int height)
Constructs an 2D image component object using the specified format, width and height.
Parameters:
format - the image component format, one of: FORMAT_RGB, FORMAT_RGBA, etc.
width - the number of columns of pixels in this image component object
height - the number of rows of pixels in this image component object
Throws:
java.lang.IllegalArgumentException - if format is invalid or width/height are non-positive.

ImageComponent2D

public ImageComponent2D(int format,
                        java.awt.image.BufferedImage image)
Constructs an 2D image component object using the specified format, and BufferedImage. A copy of the BufferedImage is made.
Parameters:
format - the image component format, one of: FORMAT_RGB, FORMAT_RGBA, etc.
image - the BufferedImage used to create this 2D image component.
Throws:
java.lang.IllegalArgumentException - if format is invalid or width/height are non-positive.
Method Detail

set

public final void set(java.awt.image.BufferedImage image)
Copies the specified BufferedImage to this 2D image component object.
Parameters:
image - BufferedImage object containing the image. The format and size must be the same as the current format in this ImageComponent2D object.
Throws:
RestrictedAccessException - if the method is called when this object is part of live or compiled scene graph.

getImage

public final java.awt.image.BufferedImage getImage()
Retrieves a copy of the image in this ImageComponent2D object.
Returns:
a new BufferedImage object created from the image in this ImageComponent2D object
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 ImageComponent2D object. Called from a Leaf node's duplicateNode method.
Overrides:
cloneNodeComponent in class NodeComponent
Returns:
a duplicate of the ImageComponent2D 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.duplicateNodeComponent(javax.media.j3d.NodeComponent), NodeComponent.setDuplicateOnCloneTree(boolean)