| java.lang.Object javax.media.j3d.SceneGraphObject javax.media.j3d.NodeComponent javax.media.j3d.ImageComponent javax.media.j3d.ImageComponent2D
All known Subclasses: org.jdesktop.j3dfly.utils.image.ImageComponent2DURL, com.sun.j3d.utils.scenegraph.io.state.com.sun.j3d.utils.image.ImageComponent2DURL, org.jdesktop.j3d.utils.scenegraph.ImageComponent2DURL,
ImageComponent2D | public class ImageComponent2D extends ImageComponent (Code) | | This class defines a 2D image component. This is used for texture
images, background images and raster components of Shape3D nodes.
Prior to Java 3D 1.2, only BufferedImage objects could be used as the
input to an ImageComponent2D object. As of Java 3D 1.2, an
ImageComponent2D accepts any RenderedImage object (BufferedImage is
an implementation of the RenderedImage interface). The methods
that set/get a BufferedImage object are left in for compatibility.
The new methods that set/get a RenderedImage are a superset of the
old methods. In particular, the two set methods in the following
example are equivalent:
As of Java 3D 1.5, an ImageComponent2D accepts an NioImageBuffer object
as an alternative to a RenderedImage.
|
Inner Class :public static interface Updater | |
Constructor Summary | |
| ImageComponent2D() | public | ImageComponent2D(int format, int width, int height) Constructs a 2D image component object using the specified
format, width, and height. | public | ImageComponent2D(int format, BufferedImage image) Constructs a 2D image component object using the specified format
and BufferedImage. | public | ImageComponent2D(int format, RenderedImage image) Constructs a 2D image component object using the specified format
and RenderedImage. | public | ImageComponent2D(int format, int width, int height, boolean byReference, boolean yUp) Constructs a 2D image component object using the specified
format, width, height, byReference flag, and yUp flag.
Default values are used for all other parameters.
Parameters: format - the image component format, one of: FORMAT_RGB,FORMAT_RGBA, etc. Parameters: width - the number of columns of pixels in this image componentobject Parameters: height - the number of rows of pixels in this image componentobject Parameters: byReference - a flag that indicates whether the data is copiedinto this image component object or is accessed by reference. Parameters: yUp - a flag that indicates the y-orientation of this imagecomponent. | public | ImageComponent2D(int format, BufferedImage image, boolean byReference, boolean yUp) Constructs a 2D image component object using the specified format,
BufferedImage, byReference flag, and yUp flag.
The image class is set to ImageClass.BUFFERED_IMAGE.
Parameters: format - the image component format, one of: FORMAT_RGB,FORMAT_RGBA, etc. Parameters: image - the BufferedImage used to create this 2D image component Parameters: byReference - a flag that indicates whether the data is copiedinto this image component object or is accessed by reference Parameters: yUp - a flag that indicates the y-orientation of this imagecomponent. | public | ImageComponent2D(int format, RenderedImage image, boolean byReference, boolean yUp) Constructs a 2D image component object using the specified format,
RenderedImage, byReference flag, and yUp flag.
The image class is set to ImageClass.RENDERED_IMAGE if the byReferece
flag is true and the specified RenderedImage is not an instance
of BufferedImage. | public | ImageComponent2D(int format, NioImageBuffer image, boolean byReference, boolean yUp) Constructs a 2D image component object using the specified format,
NioImageBuffer, byReference flag, and yUp flag.
The image class is set to ImageClass.NIO_IMAGE_BUFFER.
Parameters: format - the image component format, one of: FORMAT_RGB,FORMAT_RGBA, etc. Parameters: image - the NioImageBuffer used to create this 2D image component Parameters: byReference - a flag that indicates whether the data is copiedinto this image component object or is accessed by reference. Parameters: yUp - a flag that indicates the y-orientation of this imagecomponent. |
Method Summary | |
public NodeComponent | cloneNodeComponent() | void | createRetained() Creates a retained mode ImageComponent2DRetained object that this
ImageComponent2D component object will point to. | void | duplicateAttributes(NodeComponent originalNodeComponent, boolean forceDuplicate) Copies all node information from originalNodeComponent
into the current node. | public BufferedImage | getImage() Retrieves the image from this ImageComponent2D object. | public NioImageBuffer | getNioImage() Retrieves the image from this ImageComponent2D object. | public RenderedImage | getRenderedImage() Retrieves the image from this ImageComponent2D object. | public void | set(BufferedImage image) Sets this image component to the specified BufferedImage
object.
If the data access mode is not by-reference, then the
BufferedImage data is copied into this object. | public void | set(RenderedImage image) Sets this image component to the specified RenderedImage
object. | public void | set(NioImageBuffer image) Sets this image component to the specified NioImageBuffer
object. | public void | setSubImage(RenderedImage image, int width, int height, int srcX, int srcY, int dstX, int dstY) Modifies a contiguous subregion of the image component.
Block of data of dimension (width * height)
starting at the offset (srcX, srcY) of the specified
RenderedImage object will be copied into the image component
starting at the offset (dstX, dstY) of the ImageComponent2D object.
The specified RenderedImage object must be of the same format as
the current RenderedImage object in this image component.
This method can only be used if the data access mode is
by-copy. | public void | updateData(Updater updater, int x, int y, int width, int height) Updates image data that is accessed by reference. |
ImageComponent2D | ImageComponent2D()(Code) | | |
ImageComponent2D | public ImageComponent2D(int format, int width, int height)(Code) | | Constructs a 2D image component object using the specified
format, width, and height. Default values are used for
all other parameters. The default values are as follows:
image : null
imageClass : ImageClass.BUFFERED_IMAGE
Parameters: format - the image component format, one of: FORMAT_RGB,FORMAT_RGBA, etc. Parameters: width - the number of columns of pixels in this image componentobject Parameters: height - the number of rows of pixels in this image componentobject exception: IllegalArgumentException - if format is invalid, or ifwidth or height are not positive. |
ImageComponent2D | public ImageComponent2D(int format, BufferedImage image)(Code) | | Constructs a 2D image component object using the specified format
and BufferedImage. A copy of the BufferedImage is made.
The image class is set to ImageClass.BUFFERED_IMAGE.
Default values are used for all other parameters.
Parameters: format - the image component format, one of: FORMAT_RGB,FORMAT_RGBA, etc. Parameters: image - the BufferedImage used to create this 2D image component. exception: IllegalArgumentException - if format is invalid, or ifthe width or height of the image are not positive. |
ImageComponent2D | public ImageComponent2D(int format, RenderedImage image)(Code) | | Constructs a 2D image component object using the specified format
and RenderedImage. A copy of the RenderedImage is made.
The image class is set to ImageClass.BUFFERED_IMAGE.
Default values are used for all other parameters.
Parameters: format - the image component format, one of: FORMAT_RGB,FORMAT_RGBA, etc. Parameters: image - the RenderedImage used to create this 2D image component exception: IllegalArgumentException - if format is invalid, or ifthe width or height of the image are not positive. since: Java 3D 1.2 |
ImageComponent2D | public ImageComponent2D(int format, int width, int height, boolean byReference, boolean yUp)(Code) | | Constructs a 2D image component object using the specified
format, width, height, byReference flag, and yUp flag.
Default values are used for all other parameters.
Parameters: format - the image component format, one of: FORMAT_RGB,FORMAT_RGBA, etc. Parameters: width - the number of columns of pixels in this image componentobject Parameters: height - the number of rows of pixels in this image componentobject Parameters: byReference - a flag that indicates whether the data is copiedinto this image component object or is accessed by reference. Parameters: yUp - a flag that indicates the y-orientation of this imagecomponent. If yUp is set to true, the origin of the image isthe lower left; otherwise, the origin of the image is the upperleft. exception: IllegalArgumentException - if format is invalid, or ifwidth or height are not positive. since: Java 3D 1.2 |
ImageComponent2D | public ImageComponent2D(int format, BufferedImage image, boolean byReference, boolean yUp)(Code) | | Constructs a 2D image component object using the specified format,
BufferedImage, byReference flag, and yUp flag.
The image class is set to ImageClass.BUFFERED_IMAGE.
Parameters: format - the image component format, one of: FORMAT_RGB,FORMAT_RGBA, etc. Parameters: image - the BufferedImage used to create this 2D image component Parameters: byReference - a flag that indicates whether the data is copiedinto this image component object or is accessed by reference Parameters: yUp - a flag that indicates the y-orientation of this imagecomponent. If yUp is set to true, the origin of the image isthe lower left; otherwise, the origin of the image is the upperleft. exception: IllegalArgumentException - if format is invalid, or ifthe width or height of the image are not positive. since: Java 3D 1.2 |
ImageComponent2D | public ImageComponent2D(int format, RenderedImage image, boolean byReference, boolean yUp)(Code) | | Constructs a 2D image component object using the specified format,
RenderedImage, byReference flag, and yUp flag.
The image class is set to ImageClass.RENDERED_IMAGE if the byReferece
flag is true and the specified RenderedImage is not an instance
of BufferedImage. In all other cases, the image class is set to
ImageClass.BUFFERED_IMAGE.
Parameters: format - the image component format, one of: FORMAT_RGB,FORMAT_RGBA, etc. Parameters: image - the RenderedImage used to create this 2D image component Parameters: byReference - a flag that indicates whether the data is copiedinto this image component object or is accessed by reference. Parameters: yUp - a flag that indicates the y-orientation of this imagecomponent. If yUp is set to true, the origin of the image isthe lower left; otherwise, the origin of the image is the upperleft. exception: IllegalArgumentException - if format is invalid, or ifthe width or height of the image are not positive. since: Java 3D 1.2 |
ImageComponent2D | public ImageComponent2D(int format, NioImageBuffer image, boolean byReference, boolean yUp)(Code) | | Constructs a 2D image component object using the specified format,
NioImageBuffer, byReference flag, and yUp flag.
The image class is set to ImageClass.NIO_IMAGE_BUFFER.
Parameters: format - the image component format, one of: FORMAT_RGB,FORMAT_RGBA, etc. Parameters: image - the NioImageBuffer used to create this 2D image component Parameters: byReference - a flag that indicates whether the data is copiedinto this image component object or is accessed by reference. Parameters: yUp - a flag that indicates the y-orientation of this imagecomponent. If yUp is set to true, the origin of the image isthe lower left; otherwise, the origin of the image is the upperleft. exception: IllegalArgumentException - if format is invalid, or ifthe width or height of the image are not positive. exception: IllegalArgumentException - if the byReference flag is false. exception: IllegalArgumentException - if the yUp flag is false. exception: IllegalArgumentException - if the number of components in format does not match the number of components in image. since: Java 3D 1.5 |
createRetained | void createRetained()(Code) | | Creates a retained mode ImageComponent2DRetained object that this
ImageComponent2D component object will point to.
|
duplicateAttributes | void duplicateAttributes(NodeComponent originalNodeComponent, boolean forceDuplicate)(Code) | | Copies all node information from originalNodeComponent
into the current node. This method is called from the
duplicateNode method. This routine does
the actual duplication of all "local data" (any data defined in
this object).
Parameters: originalNodeComponent - the original node to duplicate Parameters: forceDuplicate - when set to true , causes theduplicateOnCloneTree flag to be ignored. Whenfalse , the value of each node'sduplicateOnCloneTree variable determines whetherNodeComponent data is duplicated or copied. See Also: Node.cloneTree See Also: NodeComponent.setDuplicateOnCloneTree |
getImage | public BufferedImage getImage()(Code) | | Retrieves the image from this ImageComponent2D object. If the
data access mode is not by-reference, a copy of the image
is made. If the data access mode is by-reference, the
reference is returned.
either a new BufferedImage object created from the datain this image component, or the BufferedImage object referencedby this image component. exception: CapabilityNotSetException - if appropriate capability isnot set and this object is part of live or compiled scene graph exception: IllegalStateException - if the image class is notImageClass.BUFFERED_IMAGE. |
getNioImage | public NioImageBuffer getNioImage()(Code) | | Retrieves the image from this ImageComponent2D object. If the
data access mode is not by-reference, a copy of the image
is made. If the data access mode is by-reference, the
reference is returned.
either a new NioImageBuffer object created from the datain this image component, or the NioImageBuffer object referencedby this image component. exception: CapabilityNotSetException - if appropriate capability isnot set and this object is part of live or compiled scene graph exception: IllegalStateException - if the image class is notImageClass.NIO_IMAGE_BUFFER. since: Java 3D 1.5 |
getRenderedImage | public RenderedImage getRenderedImage()(Code) | | Retrieves the image from this ImageComponent2D object. If the
data access mode is not by-reference, a copy of the image
is made. If the data access mode is by-reference, the
reference is returned.
either a new RenderedImage object created from the datain this image component, or the RenderedImage object referencedby this image component. exception: CapabilityNotSetException - if appropriate capability isnot set and this object is part of live or compiled scene graph exception: IllegalStateException - if the image class is not one of:ImageClass.BUFFERED_IMAGE or ImageClass.RENDERED_IMAGE. since: Java 3D 1.2 |
set | public void set(BufferedImage image)(Code) | | Sets this image component to the specified BufferedImage
object.
If the data access mode is not by-reference, then the
BufferedImage data is copied into this object. If
the data access mode is by-reference, then a reference to the
BufferedImage is saved, but the data is not necessarily
copied.
The image class is set to ImageClass.BUFFERED_IMAGE.
Parameters: image - BufferedImage object containing the image.Its size must be the same as the current size of thisImageComponent2D object. exception: CapabilityNotSetException - if appropriate capability isnot set and this object is part of live or compiled scene graph exception: IllegalArgumentException - if the width and height of thespecified image is not equal to the width and height of thisImageComponent object. |
set | public void set(RenderedImage image)(Code) | | Sets this image component to the specified RenderedImage
object. If the data access mode is not by-reference, the
RenderedImage data is copied into this object. If
the data access mode is by-reference, a reference to the
RenderedImage is saved, but the data is not necessarily
copied.
The image class is set to ImageClass.RENDERED_IMAGE if the the
data access mode is by-reference and the specified
RenderedImage is not an instance of BufferedImage. In all
other cases, the image class is set to ImageClass.BUFFERED_IMAGE.
Parameters: image - RenderedImage object containing the image.Its size must be the same as the current size of thisImageComponent2D object. exception: CapabilityNotSetException - if appropriate capability isnot set and this object is part of live or compiled scene graph exception: IllegalArgumentException - if the width and height of thespecified image is not equal to the width and height of thisImageComponent object. since: Java 3D 1.2 |
set | public void set(NioImageBuffer image)(Code) | | Sets this image component to the specified NioImageBuffer
object. If the data access mode is not by-reference, the
NioImageBuffer data is copied into this object. If
the data access mode is by-reference, a reference to the
NioImageBuffer is saved, but the data is not necessarily
copied.
The image class is set to ImageClass.NIO_IMAGE_BUFFER.
Parameters: image - NioImageBuffer object containing the image.Its size must be the same as the current size of thisImageComponent2D object. exception: CapabilityNotSetException - if appropriate capability isnot set and this object is part of live or compiled scene graph exception: IllegalStateException - if this ImageComponent objectis not yUp. exception: IllegalArgumentException - if the width and height of thespecified image is not equal to the width and height of thisImageComponent object. exception: IllegalArgumentException - if the number of components in format does not match the number of components in image. since: Java 3D 1.5 |
setSubImage | public void setSubImage(RenderedImage image, int width, int height, int srcX, int srcY, int dstX, int dstY)(Code) | | Modifies a contiguous subregion of the image component.
Block of data of dimension (width * height)
starting at the offset (srcX, srcY) of the specified
RenderedImage object will be copied into the image component
starting at the offset (dstX, dstY) of the ImageComponent2D object.
The specified RenderedImage object must be of the same format as
the current RenderedImage object in this image component.
This method can only be used if the data access mode is
by-copy. If it is by-reference, see updateData().
Parameters: image - RenderedImage object containing the subimage. Parameters: width - width of the subregion. Parameters: height - height of the subregion. Parameters: srcX - starting X offset of the subregion in the specified image. Parameters: srcY - starting Y offset of the subregion in the specified image. Parameters: dstX - starting X offset of the subregion in the image component of this object. Parameters: dstY - starting Y offset of the subregion in the image component of this object. exception: CapabilityNotSetException - if appropriate capability isnot set and this object is part of live or compiled scene graph exception: IllegalStateException - if the data access mode isBY_REFERENCE . exception: IllegalArgumentException - if width or height ofthe subregion exceeds the dimension of the image of this object. exception: IllegalArgumentException - if dstX < 0, or(dstX + width ) > width of this object, or dstY < 0, or(dstY + height ) > height of this object. exception: IllegalArgumentException - if srcX < 0, or(srcX + width ) > width of the RenderedImageobject containing the subimage, or srcY < 0, or(srcY + height ) > height of the RenderedImage object containing the subimage. exception: IllegalArgumentException - if the specified RenderedImageis not compatible with the existing RenderedImage. exception: IllegalStateException - if the image class is not one of:ImageClass.BUFFERED_IMAGE or ImageClass.RENDERED_IMAGE. since: Java 3D 1.3 |
updateData | public void updateData(Updater updater, int x, int y, int width, int height)(Code) | | Updates image data that is accessed by reference.
This method calls the updateData method of the specified
ImageComponent2D.Updater object to synchronize updates to the
image data that is referenced by this ImageComponent2D object.
Applications that wish to modify such data must perform all
updates via this method.
The data to be modified has to be within the boundary of the
subregion
specified by the offset (x, y) and the dimension (width*height).
It is illegal to modify data outside this boundary.
If any referenced data is modified outisde the updateData
method, or any data outside the specified boundary is modified,
the results are undefined.
Parameters: updater - object whose updateData callback method will becalled to update the data referenced by this ImageComponent2D object. Parameters: x - starting X offset of the subregion. Parameters: y - starting Y offset of the subregion. Parameters: width - width of the subregion. Parameters: height - height of the subregion. exception: CapabilityNotSetException - if the appropriate capabilityis not set, and this object is part of a live or compiled scene graph exception: IllegalStateException - if the data access mode isBY_COPY . exception: IllegalArgumentException - if width orheight ofthe subregion exceeds the dimension of the image of this object. exception: IllegalArgumentException - if x < 0, or(x + width ) > width of this object, ory < 0, or(y + height ) > height of this object. since: Java 3D 1.3 |
Fields inherited from javax.media.j3d.NodeComponent | boolean forceDuplicate(Code)(Java Doc)
|
|
|