JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.chart3d.j3d
Class JCTexture2D

java.lang.Object
  |
  +--javax.media.j3d.SceneGraphObject
        |
        +--javax.media.j3d.NodeComponent
              |
              +--javax.media.j3d.Texture
                    |
                    +--javax.media.j3d.Texture2D
                          |
                          +--com.klg.jclass.chart3d.j3d.JCTexture2D
All Implemented Interfaces:
SwingConstants

public class JCTexture2D
extends Texture2D
implements SwingConstants


Field Summary
 
Fields inherited from class javax.media.j3d.Texture
ALLOW_BOUNDARY_COLOR_READ, ALLOW_BOUNDARY_MODE_READ, ALLOW_ENABLE_READ, ALLOW_ENABLE_WRITE, ALLOW_FILTER_READ, ALLOW_FORMAT_READ, ALLOW_IMAGE_READ, ALLOW_IMAGE_WRITE, ALLOW_MIPMAP_MODE_READ, ALLOW_SIZE_READ, ALPHA, BASE_LEVEL, BASE_LEVEL_LINEAR, BASE_LEVEL_POINT, CLAMP, FASTEST, INTENSITY, LUMINANCE, LUMINANCE_ALPHA, MULTI_LEVEL_LINEAR, MULTI_LEVEL_MIPMAP, MULTI_LEVEL_POINT, NICEST, RGB, RGBA, WRAP
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Constructor Summary
protected JCTexture2D(ImageComponent2D texture, int imageXOffset, int imageYOffset, int imageWidth, int imageHeight, int format)
          Constructs a JCTexture2D object with the specified ImageComponent2D.
 
Method Summary
static com.klg.jclass.chart3d.j3d.JCTexture2D createTexture(BufferedImage image, boolean square, int hAlignment, int vAlignment, Color fill)
          Constructs a JCTexture2D object from the specified image which must be non-null.
static com.klg.jclass.chart3d.j3d.JCTexture2D createTexture(String filename, boolean square, int hAlignment, int vAlignment, Color fill)
          Constructs a JCTexture2D object from an image file specified by filename.
static com.klg.jclass.chart3d.j3d.JCTexture2D createTexture(String filename, Color fill)
          Constructs a JCTexture2D object from an image file specified by filename.
 int getImageHeight()
          Returns the height in pixels of the source image used to construct this JCTexture2D object.
 int getImageWidth()
          Returns the width in pixels of the source image used to construct this JCTexture2D object.
 int getImageXOffset()
          Returns the x offset - measured in pixels relative to the top left corner of this JCTexture2D object - of the source image's top left corner.
 int getImageYOffest()
          Returns the y offset - measured in pixels relative to the top left corner of this JCTexture2D object - of the source image's top left corner.
 float toAlphaX(int x)
          Converts the specified texel x coordinate location to the texture coordinate system, ie returns the equivalent of x / getImageWidth().
 float toAlphaY(int y)
          Converts the specified texel y coordinate location to the texture coordinate system, ie returns the equivalent of y / getImageHeight().
 
Methods inherited from class javax.media.j3d.Texture2D
cloneNodeComponent, duplicateNodeComponent
 
Methods inherited from class javax.media.j3d.Texture
getBoundaryColor, getBoundaryModeS, getBoundaryModeT, getEnable, getFormat, getHeight, getImage, getImages, getMagFilter, getMinFilter, getMipMapMode, getWidth, numMipMapLevels, setBoundaryColor, setBoundaryColor, setBoundaryModeS, setBoundaryModeT, setEnable, setImage, setImages, setMagFilter, setMinFilter, setMipMapMode
 
Methods inherited from class javax.media.j3d.NodeComponent
cloneNodeComponent, duplicateNodeComponent, getDuplicateOnCloneTree, setDuplicateOnCloneTree
 
Methods inherited from class javax.media.j3d.SceneGraphObject
clearCapability, duplicateSceneGraphObject, getCapability, getUserData, isCompiled, isLive, setCapability, setUserData, updateNodeReferences
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JCTexture2D

protected JCTexture2D(ImageComponent2D texture,
                      int imageXOffset,
                      int imageYOffset,
                      int imageWidth,
                      int imageHeight,
                      int format)
Constructs a JCTexture2D object with the specified ImageComponent2D. The imageXOffset, imageYOffset, imageWidth, and imageHeight arguments define the location relative the texture origin, and dimensions of, the source image relative used to construct this JCTexture2D object, and are read-only. The format argument must be one of Texture.INTENSITY, LUMINANCE, ALPHA, LUMINANCE_ALPHA, RGB, or RGBA. Note that this texture object will have both it's minification and magnification filters set to Texture.NICEST by default.

Method Detail

createTexture

public static com.klg.jclass.chart3d.j3d.JCTexture2D createTexture(String filename,
                                                                   Color fill)
Constructs a JCTexture2D object from an image file specified by filename. If Java Advanced Imaging is installed then it is used to load the images, otherwise AWT toolkit it used. If the source image does not have a width and height equal to a power of two, an enlarged texture will be created for you which meets the power of two criteria. In this case, the image will be by default centred in the texture, and any texels not covered by the image will have the specified fill color.

Parameters:
filename - - image file used to construct the JCTexture2D object
fill - - color to use fill in the background if the loaded image does not have width and height equal to a power of two

createTexture

public static com.klg.jclass.chart3d.j3d.JCTexture2D createTexture(String filename,
                                                                   boolean square,
                                                                   int hAlignment,
                                                                   int vAlignment,
                                                                   Color fill)
Constructs a JCTexture2D object from an image file specified by filename. If Java Advanced Imaging is installed then it is used to load the images, otherwise AWT toolkit it used. If the source image does not have a width and height equal to a power of two, an enlarged texture will be created for you which meets the power of two criteria. In this case, the image will be aligned within the texture object according to the hAlignment and vAlignment constants, and any texels not covered by the image will have the specified fill color.

Parameters:
filename - - image file used to construct the JCTexture2D object
square - - a flag to indicate wheteher the texture should have
hAlignment - - horizontal alignment of the image within the texture - one of SwingConstants.LEFT, CENTER, or RIGHT
vAlignment - - vertical alignment of the image within the texture - one of SwingConstants.TOP, CENTER, or BOTTOM
fill - - color to use fill in the background if the loaded image does not have width and height equal to a power of two

createTexture

public static com.klg.jclass.chart3d.j3d.JCTexture2D createTexture(BufferedImage image,
                                                                   boolean square,
                                                                   int hAlignment,
                                                                   int vAlignment,
                                                                   Color fill)
Constructs a JCTexture2D object from the specified image which must be non-null. If the source image does not have a width and height equal to a power of two, an enlarged texture will be created for you which meets the power of two criteria. In this case, the image will be aligned within the texture object according to the hAlignment and vAlignment constants, and any texels not covered by the image will have the specified fill color.

Parameters:
image - - non-null image used to construct this JCTexture2D object
square - - a flag to indicate wheteher the texture should have
hAlignment - - horizontal alignment of the image within the texture - one of SwingConstants.LEFT, CENTER, or RIGHT
vAlignment - - vertical alignment of the image within the texture - one of SwingConstants.TOP, CENTER, or BOTTOM
fill - - color to use fill in the background if the loaded image does not have width and height equal to a power of two

toAlphaX

public float toAlphaX(int x)
Converts the specified texel x coordinate location to the texture coordinate system, ie returns the equivalent of x / getImageWidth().


toAlphaY

public float toAlphaY(int y)
Converts the specified texel y coordinate location to the texture coordinate system, ie returns the equivalent of y / getImageHeight().


getImageXOffset

public int getImageXOffset()
Returns the x offset - measured in pixels relative to the top left corner of this JCTexture2D object - of the source image's top left corner.

Returns:
the x offset of the source image

getImageYOffest

public int getImageYOffest()
Returns the y offset - measured in pixels relative to the top left corner of this JCTexture2D object - of the source image's top left corner.

Returns:
the y offset of the source image

getImageWidth

public int getImageWidth()
Returns the width in pixels of the source image used to construct this JCTexture2D object. The functinality of this method is identical to Texture.getWidth(), but note that the Texture.ALLOW_SIZE_READ capability does not have to be set to use this method.

Returns:
the width in pixels of the source image

getImageHeight

public int getImageHeight()
Returns the height in pixels of the source image used to construct this JCTexture2D object. The functinality of this method is identical to Texture.getHeight(), but note that the Texture.ALLOW_SIZE_READ capability does not have to be set to use this method.

Returns:
the height in pixels of the source image

Copyright © 2004 Quest Software Inc..
All rights reserved.