Package vrml.field
Class SFImage
java.lang.Object
vrml.Field
vrml.field.SFImage
- All Implemented Interfaces:
Cloneable
VRML JSAI type class containing a image field.
Unlike th e other fields, this field always replaces the existing array rather than copy values in. It assumes that pixel textures are not changed all that often.
- Version:
- $Revision: 1.6 $
- Author:
- Alan Hudson, Justin Couch
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
The number of components in the image pixelsprotected int
The height of the imageprotected byte[]
The raw pixel dataprotected int
The width of the imageFields inherited from class vrml.Field
valueChanged
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()
Create a cloned copy of this node.int
Get the number of components of the imageint
Get the height of the image in pixels.void
getPixels
(byte[] pixels) Copy the image pixels into the user provided array.int
getWidth()
Get the width of the image in pixels.void
setValue
(int width, int height, int components, byte[] pixels) Set the content of the image field.void
setValue
(ConstSFImage image) Set the contents of this field based on the contents of another field.void
Set the contents of this field based on the contents of another field.toString()
Create a string representation of this field.
-
Field Details
-
imageWidth
protected int imageWidthThe width of the image -
imageHeight
protected int imageHeightThe height of the image -
imageComponents
protected int imageComponentsThe number of components in the image pixels -
imagePixels
protected byte[] imagePixelsThe raw pixel data
-
-
Constructor Details
-
SFImage
public SFImage()Create a default image that has no size or pixels -
SFImage
public SFImage(int width, int height, int components, byte[] pixels) Create a new image based on the given details.- Parameters:
width
- The width in pixels of the imageheight
- The height in pixels of the imagecomponents
- The number of components in the image [0-4]pixels
- The raw pixels of the image
-
-
Method Details
-
getWidth
public int getWidth()Get the width of the image in pixels.- Returns:
- The width of the image
-
getHeight
public int getHeight()Get the height of the image in pixels.- Returns:
- The height of the image
-
getComponents
public int getComponents()Get the number of components of the image- Returns:
- The number of components [0-4]
-
getPixels
public void getPixels(byte[] pixels) Copy the image pixels into the user provided array.- Parameters:
pixels
- The array to copy data into
-
setValue
public void setValue(int width, int height, int components, byte[] pixels) Set the content of the image field.- Parameters:
width
- The width in pixels of the imageheight
- The height in pixels of the imagecomponents
- The number of components in the image [0-4]pixels
- The raw pixels of the image
-
setValue
Set the contents of this field based on the contents of another field.- Parameters:
image
- The field to copy information for it
-
setValue
Set the contents of this field based on the contents of another field.- Parameters:
image
- The field to copy information for it
-
toString
-
clone
-