j3d.org Aviatrix3D

org.j3d.aviatrix3d
Class ImageTextureComponent2D

java.lang.Object
  extended byorg.j3d.aviatrix3d.SceneGraphObject
      extended byorg.j3d.aviatrix3d.NodeComponent
          extended byorg.j3d.aviatrix3d.TextureComponent
              extended byorg.j3d.aviatrix3d.TextureComponent2D
                  extended byorg.j3d.aviatrix3d.ImageTextureComponent2D
All Implemented Interfaces:
ImageTextureComponent

public class ImageTextureComponent2D
extends TextureComponent2D
implements ImageTextureComponent

Wraps a 2D image.

Version:
$Revision: 1.10 $
Author:
Alan Hudson

Field Summary
 
Fields inherited from class org.j3d.aviatrix3d.TextureComponent2D
height
 
Fields inherited from class org.j3d.aviatrix3d.TextureComponent
data, format, FORMAT_BGR, FORMAT_BGRA, FORMAT_INTENSITY_ALPHA, FORMAT_RGB, FORMAT_RGBA, FORMAT_SINGLE_COMPONENT, invertY, numLevels, size, type, TYPE_BYTE, TYPE_INT, width
 
Fields inherited from class org.j3d.aviatrix3d.NodeComponent
liveCount
 
Fields inherited from class org.j3d.aviatrix3d.SceneGraphObject
alive, updateHandler, WRITE_TIMING_MSG
 
Constructor Summary
ImageTextureComponent2D()
          Constructs an image with default values.
ImageTextureComponent2D(boolean yUp)
          Constructs an image with default values.
ImageTextureComponent2D(int format, int width, int height, java.awt.image.RenderedImage srcImage)
          Constructs an Image2D using the specified format, width, height and rendered image.
ImageTextureComponent2D(int format, int width, int height, java.awt.image.RenderedImage srcImage, boolean yUp)
          Constructs an Image2D using the specified format, width, height and rendered image.
ImageTextureComponent2D(int format, java.awt.image.RenderedImage srcImage)
          Constructs an Image2D using the specified format and rendered image.
ImageTextureComponent2D(int format, java.awt.image.RenderedImage[] srcImages)
          Constructs an Image2D using the specified format and an array of rendered images.
ImageTextureComponent2D(int format, java.awt.image.RenderedImage[] srcImages, boolean yUp)
          Constructs an Image2D using the specified format and rendered images.
ImageTextureComponent2D(int format, java.awt.image.RenderedImage srcImage, boolean yUp)
          Constructs an Image2D using the specified format and rendered image.
 
Method Summary
 void clearLocalData()
          Clear local data stored in this node.
protected  java.nio.ByteBuffer convertImage(int level)
          Convenience method to convert a buffered image into a NIO array of the corresponding type.
 void updateSubImage(int srcX, int srcY, int destX, int destY, int widht, int height, int lvl, java.awt.image.RenderedImage img)
          Update a sub-section of the image data with the new pixel values.
 
Methods inherited from class org.j3d.aviatrix3d.TextureComponent2D
getHeight
 
Methods inherited from class org.j3d.aviatrix3d.TextureComponent
clearData, getData, getFormat, getNumLevels, getWidth, isYUp
 
Methods inherited from class org.j3d.aviatrix3d.NodeComponent
addParent, getParents, hasChanged, numParents, removeParent, renderState, restoreState
 
Methods inherited from class org.j3d.aviatrix3d.SceneGraphObject
checkForCyclicChild, checkForCyclicParent, dataChanged, getUserData, isLive, setLive, setUpdateHandler, setUserData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageTextureComponent2D

public ImageTextureComponent2D()
Constructs an image with default values.


ImageTextureComponent2D

public ImageTextureComponent2D(boolean yUp)
Constructs an image with default values.

Parameters:
yUp - Change the image aroud the Y axis if needed

ImageTextureComponent2D

public ImageTextureComponent2D(int format,
                               int width,
                               int height,
                               java.awt.image.RenderedImage srcImage)
Constructs an Image2D using the specified format, width, height and rendered image. If the srcImage[0] is an instance of BufferedImage, the format passed is ignored and the image directly used.

Parameters:
format - The image format. RGB, RGBA currently
width - The width of the image
height - The height of the image
srcImage - The image data

ImageTextureComponent2D

public ImageTextureComponent2D(int format,
                               int width,
                               int height,
                               java.awt.image.RenderedImage srcImage,
                               boolean yUp)
Constructs an Image2D using the specified format, width, height and rendered image. If the srcImage[0] is an instance of BufferedImage, the format passed is ignored and the image directly used.

Parameters:
format - The image format. RGB, RGBA currently
width - The width of the image
height - The height of the image
srcImage - The image data
yUp - Change the image aroud the Y axis if needed

ImageTextureComponent2D

public ImageTextureComponent2D(int format,
                               java.awt.image.RenderedImage srcImage)
Constructs an Image2D using the specified format and rendered image.

Parameters:
format - The image format. RGB, RGBA currently

ImageTextureComponent2D

public ImageTextureComponent2D(int format,
                               java.awt.image.RenderedImage[] srcImages)
Constructs an Image2D using the specified format and an array of rendered images. Any images past the first are assumed to be mipmap levels.

Parameters:
format - The image format. RGB, RGBA currently
srcImages - The image data. They must all be of the same type

ImageTextureComponent2D

public ImageTextureComponent2D(int format,
                               java.awt.image.RenderedImage srcImage,
                               boolean yUp)
Constructs an Image2D using the specified format and rendered image.

Parameters:
format - The image format. RGB, RGBA currently
yUp - Change the image aroud the Y axis if needed

ImageTextureComponent2D

public ImageTextureComponent2D(int format,
                               java.awt.image.RenderedImage[] srcImages,
                               boolean yUp)
Constructs an Image2D using the specified format and rendered images.

Parameters:
format - The image format. RGB, RGBA currently
srcImages - The image data
yUp - Change the image aroud the Y axis if needed
Method Detail

updateSubImage

public void updateSubImage(int srcX,
                           int srcY,
                           int destX,
                           int destY,
                           int widht,
                           int height,
                           int lvl,
                           java.awt.image.RenderedImage img)
                    throws InvalidWriteTimingException
Update a sub-section of the image data with the new pixel values. Not implemented yet.

Specified by:
updateSubImage in interface ImageTextureComponent
Parameters:
srcX - The starting X offset in the existing image space
srcY - The starting Y offset in the existing image space
destX - The starting X offset in the existing image space
destY - The starting Y offset in the existing image space
height - The height of the section to replace
img - The image to take data from
widht - The width of the section to replace
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

clearLocalData

public void clearLocalData()
Clear local data stored in this node. Only data needed for OpenGL calls will be retained;

Specified by:
clearLocalData in class TextureComponent

convertImage

protected java.nio.ByteBuffer convertImage(int level)
Convenience method to convert a buffered image into a NIO array of the corresponding type. Images typically need to be swapped when doing this by the Y axis is in the opposite direction to the one used by OpenGL.

Specified by:
convertImage in class TextureComponent
Parameters:
level - Which image level needs to be converted
Returns:
an appropriate array type - either IntBuffer or ByteBuffer

j3d.org Aviatrix3D

Latest Info from http://aviatrix3d.j3d.org/
Copyright © 2003 - j3d.org