Aviatrix3D
2.1.0

org.j3d.aviatrix3d
Class ByteRaster

java.lang.Object
  extended by org.j3d.aviatrix3d.SceneGraphObject
      extended by org.j3d.aviatrix3d.NodeComponent
          extended by org.j3d.aviatrix3d.Raster
              extended by org.j3d.aviatrix3d.ByteRaster
All Implemented Interfaces:
java.lang.Comparable, LeafPickTarget, PickableObject, PickTarget, GeometryRenderable, Renderable

public class ByteRaster
extends Raster

Raster object that represents a coloured image defined by a raw byte array.

The image raster can contain 1 to 4 colour components in the definition.

Internationalisation Resource Names

Version:
$Revision: 2.6 $
Author:
Justin Couch

Field Summary
static int FORMAT_BGR
          Specifies the source is in Windows BGR format
static int FORMAT_BGRA
          Specifies the source is in Windows BGRA format
static int FORMAT_INTENSITY
          Specifies the source is in 1-component Intensity (greyscale) format
static int FORMAT_INTENSITY_ALPHA
          Specifies the source is in 2-component Intensity-Alpha format
static int FORMAT_RGB
          Specifies the source is in RGB format
static int FORMAT_RGBA
          Specifies the source is in RGBA format
 
Fields inherited from class org.j3d.aviatrix3d.Raster
bounds, implicitBounds, internalUpdater, INVALID_BOUNDS, lastParentList, parentList, pickFlags, validAlpha
 
Fields inherited from class org.j3d.aviatrix3d.NodeComponent
lastParent, liveCount
 
Fields inherited from class org.j3d.aviatrix3d.SceneGraphObject
alive, LISTENER_SET_TIMING_ERR_PROP, updateHandler
 
Fields inherited from interface org.j3d.aviatrix3d.picking.PickableObject
COLLIDABLE_OBJECT, GENERAL_OBJECT, PROXIMITY_OBJECT, VISIBLE_OBJECT
 
Fields inherited from interface org.j3d.aviatrix3d.picking.PickTarget
CUSTOM_PICK_TYPE, GROUP_PICK_TYPE, LEAF_PICK_TYPE, SINGLE_PICK_TYPE
 
Constructor Summary
ByteRaster(int width, int height, int format)
          Create a new empty raster with the given width and height.
 
Method Summary
 int compareTo(ByteRaster ir)
          Compares this object with the specified object for order.
 int compareTo(java.lang.Object o)
          Compares this object with the specified object for order.
 boolean equals(ByteRaster ir)
          Compares this object with the specified object to check for equivalence.
 boolean equals(java.lang.Object o)
          Compare this object for equality to the given object.
 void getBits(byte[] bitmask)
          Retrieve the vertices that are currently set.
 int getHeight()
          Get the height of this bitmap.
 int getWidth()
          Get the width of this bitmap.
 boolean pickLineRay(float[] origin, float[] direction, boolean findAny, float[] dataOut, int dataOutFlags)
          Check for all intersections against this geometry using a line ray and return the exact distance away of the closest picking point.
 boolean pickLineSegment(float[] start, float[] end, boolean findAny, float[] dataOut, int dataOutFlags)
          Check for all intersections against this geometry using a line segment and return the exact distance away of the closest picking point.
protected  void recomputeBounds()
          Internal method to recalculate the implicit bounds of this Node.
 void render(javax.media.opengl.GL gl)
          Render the geometry now.
 void setBits(byte[] pixels)
          Set the pixel data for the bitmap contents.
 void setBits(byte[] pixels, int width, int height, int format)
          Set the pixel data for the bitmap contents and change the size of the raster at the same time.
protected  void setLive(boolean state)
          Notification that this object is live now.
protected  void updateBounds()
          Update this node's bounds and then call the parent to update it's bounds.
 
Methods inherited from class org.j3d.aviatrix3d.Raster
addParent, boundsChanged, checkPickMask, getBounds, getPickableBounds, getPickMask, getPickTargetType, hasTransparency, isVisible, markBoundsDirty, pickBatch, pickSingle, removeParent, setBounds, setPickMask
 
Methods inherited from class org.j3d.aviatrix3d.NodeComponent
addParent, getParents, numParents, removeParent
 
Methods inherited from class org.j3d.aviatrix3d.SceneGraphObject
checkForCyclicChild, checkForCyclicParent, dataChanged, getAppUpdateWriteTimingMessage, getBoundsWriteTimingMessage, getDataWriteTimingMessage, getUserData, isLive, setUpdateHandler, setUserData
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FORMAT_RGB

public static final int FORMAT_RGB
Specifies the source is in RGB format

See Also:
Constant Field Values

FORMAT_RGBA

public static final int FORMAT_RGBA
Specifies the source is in RGBA format

See Also:
Constant Field Values

FORMAT_BGR

public static final int FORMAT_BGR
Specifies the source is in Windows BGR format

See Also:
Constant Field Values

FORMAT_BGRA

public static final int FORMAT_BGRA
Specifies the source is in Windows BGRA format

See Also:
Constant Field Values

FORMAT_INTENSITY_ALPHA

public static final int FORMAT_INTENSITY_ALPHA
Specifies the source is in 2-component Intensity-Alpha format

See Also:
Constant Field Values

FORMAT_INTENSITY

public static final int FORMAT_INTENSITY
Specifies the source is in 1-component Intensity (greyscale) format

See Also:
Constant Field Values
Constructor Detail

ByteRaster

public ByteRaster(int width,
                  int height,
                  int format)
Create a new empty raster with the given width and height.

Parameters:
width - The width of the raster in pixels
height - The height of the raster in pixels
format - One of the FORMAT_ values describing the byte format
Throws:
java.lang.IllegalArgumentException - The width or height are not positive or an invalid pixel format
Method Detail

render

public void render(javax.media.opengl.GL gl)
Render the geometry now.

Parameters:
gl - The GL context to render with

pickLineSegment

public boolean pickLineSegment(float[] start,
                               float[] end,
                               boolean findAny,
                               float[] dataOut,
                               int dataOutFlags)
                        throws NotPickableException
Check for all intersections against this geometry using a line segment and return the exact distance away of the closest picking point. Default implementation always returns false indicating that nothing was found. Derived classes should override and provide a real implementation.

Specified by:
pickLineSegment in interface LeafPickTarget
Overrides:
pickLineSegment in class Raster
Parameters:
start - The start point of the segment
end - The end point of the segment
findAny - True if it only has to find a single intersection and can exit as soon as it finds the first intersection. False if it must find the closest polygon
dataOut - An array to put the data in for the intersection. Exact format is described by the flags
dataOutFlags - A set of derived-class specific flags describing what data should be included in the output array
Returns:
True if an intersection was found according to the input request
Throws:
NotPickableException - This object has been marked as non pickable, but you decided to try to call the method anyway

pickLineRay

public boolean pickLineRay(float[] origin,
                           float[] direction,
                           boolean findAny,
                           float[] dataOut,
                           int dataOutFlags)
                    throws NotPickableException
Check for all intersections against this geometry using a line ray and return the exact distance away of the closest picking point. Default implementation always returns false indicating that nothing was found. Derived classes should override and provide a real implementation.

Specified by:
pickLineRay in interface LeafPickTarget
Overrides:
pickLineRay in class Raster
Parameters:
origin - The start point of the ray
direction - The direction vector of the ray
findAny - True if it only has to find a single intersection and can exit as soon as it finds the first intersection. False if it must find the closest polygon
dataOut - An array to put the data in for the intersection. Exact format is described by the flags
dataOutFlags - A set of derived-class specific flags describing what data should be included in the output array
Returns:
True if an intersection was found according to the input request
Throws:
NotPickableException - This object has been marked as non pickable, but you decided to try to call the method anyway

updateBounds

protected void updateBounds()
Update this node's bounds and then call the parent to update it's bounds. Used to propogate bounds changes from the leaves of the tree to the root. A node implementation may decide when and where to tell the parent(s)s that updates are ready.

Overrides:
updateBounds in class Raster

recomputeBounds

protected void recomputeBounds()
Internal method to recalculate the implicit bounds of this Node. By default the bounds are a point sphere, so derived classes should override this method with something better.

Specified by:
recomputeBounds in class Raster

setLive

protected void setLive(boolean state)
Notification that this object is live now. Overridden to make sure that the live state of the nodes represents the same state as the parent scene graph.

Overrides:
setLive in class SceneGraphObject
Parameters:
state - true if this should be marked as live now

compareTo

public int compareTo(java.lang.Object o)
              throws java.lang.ClassCastException
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Parameters:
o - The objec to be compared
Returns:
-1, 0 or 1 depending on order
Throws:
java.lang.ClassCastException - The specified object's type prevents it from being compared to this Object

equals

public boolean equals(java.lang.Object o)
Compare this object for equality to the given object.

Specified by:
equals in interface Renderable
Overrides:
equals in class java.lang.Object
Parameters:
o - The object to be compared
Returns:
True if these represent the same values

getHeight

public int getHeight()
Get the height of this bitmap.

Returns:
the height.

getWidth

public int getWidth()
Get the width of this bitmap.

Returns:
the width.

setBits

public void setBits(byte[] pixels)
             throws InvalidWriteTimingException,
                    java.lang.IllegalArgumentException
Set the pixel data for the bitmap contents. Each byte represents 8 pixels of the image. See class documentation for more information. A null reference can be used to clear the bitmap and not have anything appear on screen.

Parameters:
pixels - The bytes to use for the raster or null to clear
Throws:
java.lang.IllegalArgumentException - The number of bytes is not sufficient to fulfill the previously set width and height of the bitmap
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener data callback method

setBits

public void setBits(byte[] pixels,
                    int width,
                    int height,
                    int format)
             throws InvalidWriteTimingException,
                    java.lang.IllegalArgumentException
Set the pixel data for the bitmap contents and change the size of the raster at the same time. Each byte represents 8 pixels of the image. See class documentation for more information. A null reference can be used to clear the bitmap and not have anything appear on screen. Because this is also changing the bounds of the image, it needs to be called during the bounds callback, not the data callback like the other setBits method.

Parameters:
pixels - The bytes to use for the raster or null to clear
width - The width of the raster in pixels
height - The height of the raster in pixels
format - One of the FORMAT_ values describing the byte format
Throws:
java.lang.IllegalArgumentException - The width or height are not positive
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener bounds callback method

getBits

public void getBits(byte[] bitmask)
Retrieve the vertices that are currently set. The array must be at least as long as the valid vertex count, times 3. If none are set currently or have been cleared, the provided array is untouched.

Parameters:
bitmask - The array to copy the bit mask values into
Throws:
java.lang.ArrayIndexOutOfBoundsException - The provided array is too short

compareTo

public int compareTo(ByteRaster ir)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Parameters:
ir - The argument instance to be compared
Returns:
-1, 0 or 1 depending on order

equals

public boolean equals(ByteRaster ir)
Compares this object with the specified object to check for equivalence.

Parameters:
ir - The image instance to be compared
Returns:
true if the objects represent identical values

Aviatrix3D
2.1.0

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