|
Xj3D 2.0 VRML/X3D Code API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface MFImage
Representation of a MFImage field.
Images are represented as arrays of integers as per the X3D specification Section 5.7 SFImage and MFImage. Pixel values are between 0 and 256 and represented as integers to maintain consistency with java's ImageConsumer interface and PixelGrabber class.
| Method Summary | |
|---|---|
void |
append(int value)
Places a new value at the end of the existing value, increasing the field length accordingly. |
void |
clear()
Removes all values in the field and changes the field size to zero. |
int |
getComponents(int imgIndex)
Get the number of colour components in the image. |
int |
getHeight(int imgIndex)
Get the height of the image. |
java.awt.image.WritableRenderedImage |
getImage(int imgIndex)
Fetch the Java representation of the underlying image from these pixels. |
void |
getPixels(int imgIndex,
int[] pixels)
Get the image pixel value in the given eventOut. |
int |
getWidth(int imgIndex)
Get the width of the image at index i in the array. |
void |
insertValue(int index,
int value)
Inserts a value into an existing index of the field. |
void |
removeValue(int index)
Removes one value from the field. |
void |
set1Value(int index,
int value)
Set one pixel value at the correct index in this field. |
void |
set1Value(int imgIndex,
int width,
int height,
int components,
int[] pixels)
Set the image value in the given writable field. |
void |
setImage(int imgIndex,
java.awt.image.RenderedImage img)
Set the image value in the given writable field to the new image defined by a set of pixels. |
void |
setImage(java.awt.image.RenderedImage[] img)
Set the given writable field to the new array of image values. |
void |
setSubImage(int imgIndex,
java.awt.image.RenderedImage img,
int srcWidth,
int srcHeight,
int srcXOffset,
int srcYOffset,
int destXOffset,
int destYOffset)
Copy a region of the argument RenderedImage to replace a portion of the current SFimage. |
void |
setValue(int numValues,
int[] value)
Set the value of the array to this value. |
| Methods inherited from interface org.web3d.x3d.sai.MField |
|---|
getSize |
| Methods inherited from interface org.web3d.x3d.sai.X3DField |
|---|
addX3DEventListener, getDefinition, getUserData, isReadable, isWritable, removeX3DEventListener, setUserData |
| Method Detail |
|---|
void append(int value)
value - The value to appendvoid clear()
int getWidth(int imgIndex)
imgIndex - The index of the image in the array
int getHeight(int imgIndex)
imgIndex - The index of the image in the array
int getComponents(int imgIndex)
imgIndex - The index of the image in the array
void getPixels(int imgIndex,
int[] pixels)
The number of items in the pixels array will be
1 Component Images
2 Component Images
3 Component Images
4 Component Images
The width and height values must be greater than or equal to zero. The
number of components is between 1 and 4. Any value outside of these
bounds will generate an IllegalArgumentException.
width * height. If there are less items than this an
ArrayIndexOutOfBoundsException will be generated. The integer values
are represented according to the number of components.
The integer has the intensity value stored in the lowest byte and can be
obtained:
intensity = (pixel[i] ) & 0xFF;
The integer has the transparency value stored in the lowest byte and the
intensity in the next byte:
intensity = (pixel[i] >> 8) & 0xFF;
alpha = (pixel[i] ) & 0xFF;
The three color components are stored in the integer array as follows:
red = (pixel[i] >> 16) & 0xFF;
green = (pixel[i] >> 8) & 0xFF;
blue = (pixel[i] ) & 0xFF;
The integer has the value stored in the array as follows:
red = (pixel[i] >> 24) & 0xFF;
green = (pixel[i] >> 16) & 0xFF;
blue = (pixel[i] >> 8) & 0xFF;
alpha = (pixel[i] ) & 0xFF;
imgIndex - The index of the image in the arraypixels - The array to copy pixel values into
java.awt.image.WritableRenderedImage getImage(int imgIndex)
imgIndex - The index of the image in the array
void insertValue(int index,
int value)
throws java.lang.ArrayIndexOutOfBoundsException
index - The position at which to insertvalue - The new element to insert
java.lang.ArrayIndexOutOfBoundsException - The index was outside the current field
size.
void removeValue(int index)
throws java.lang.ArrayIndexOutOfBoundsException
index - The position of the value to remove.
java.lang.ArrayIndexOutOfBoundsException - The index was outside the current field
size.
void setImage(int imgIndex,
java.awt.image.RenderedImage img)
throws InvalidOperationTimingException,
InvalidFieldValueException,
InvalidWritableFieldException,
InvalidFieldException
imgIndex - The index of the image in the arrayimg - The new image to use as the source
InvalidOperationTimingException
InvalidFieldValueException
InvalidWritableFieldException
InvalidFieldException
void setSubImage(int imgIndex,
java.awt.image.RenderedImage img,
int srcWidth,
int srcHeight,
int srcXOffset,
int srcYOffset,
int destXOffset,
int destYOffset)
throws InvalidOperationTimingException,
InvalidFieldValueException,
InvalidWritableFieldException,
InvalidFieldException
The sub image set shall not resize the base image representation and therefore performs an intersection clip of the provided image. The user provided image shall be of the same format (pixel depth, pixel representation) as the original image obtained through the getImage() method.
RenderedImages are row order from top to bottom. A 4x8 RenderImage is indexed as follows:
X >01234567 ---------- 0 |********| 1 |********| 2 |********| 3 |********| ^ ---------- YSFImages are row order from bottom to top. A 4x8 RenderImage is indexed as follows:
X >01234567 ---------- 3 |********| 2 |********| 1 |********| 0 |********| ^ ---------- Y
Note: The parameter srcYOffset is referenced to the RenderedImage object
(indexed top to bottom).
The parameter destYOffset is referenced to the SFImage object
(indexed bottom to top).
imgIndex - The index of the image in the arrayimg - The new image to use as the sourcesrcWidth - The width of the argument sub-image region to copysrcHeight - The height of the argument sub-image region to copysrcXOffset - The initial x dimension (width) offset into the
argument sub-image that begins the region to copysrcYOffset - The initial y dimension (height) offset into the
argument sub-image that begins the region to copydestXOffset - The initial x dimension (width) offset in the SFimage
object that begins the region to receive the copydestYOffset - The initial y dimension (height) offset in the SFimage
object that begins the region to receive the copy
InvalidOperationTimingException
InvalidFieldValueException
InvalidWritableFieldException
InvalidFieldException
void set1Value(int index,
int value)
index - The position in the array to setvalue - The value to use at that position
void set1Value(int imgIndex,
int width,
int height,
int components,
int[] pixels)
Image values are specified using a width, height and the number of
components. The number of items in the pixels array must be at least
1 Component Images
2 Component Images
3 Component Images
4 Component Images
The width and height values must be greater than or equal to zero. The
number of components is between 1 and 4. Any value outside of these
bounds will generate an IllegalArgumentException.
width * height. If there are less items than this an
ArrayIndexOutOfBoundsException will be generated. The integer values
are represented according to the number of components. If the integer
contains values in bytes that are not used by the number of components
for that image, the values are ignored.
The integer has the intensity value stored in the lowest byte and can be
obtained:
intensity = (pixel[i] ) & 0xFF;
The integer has the transparency value stored in the lowest byte and the
intensity in the next byte:
intensity = (pixel[i] >> 8) & 0xFF;
alpha = (pixel[i] ) & 0xFF;
The three color components are stored in the integer array as follows:
red = (pixel[i] >> 16) & 0xFF;
green = (pixel[i] >> 8) & 0xFF;
blue = (pixel[i] ) & 0xFF;
The integer has the value stored in the array as follows:
red = (pixel[i] >> 24) & 0xFF;
green = (pixel[i] >> 16) & 0xFF;
blue = (pixel[i] >> 8) & 0xFF;
alpha = (pixel[i] ) & 0xFF;
imgIndex - The index of the image in the arraywidth - The width of the image in pixelsheight - The height of the image in pixelscomponents - The number of colour components [1-4]pixels - The array of pixel values as specified above.
java.lang.IllegalArgumentException - The number of components or width/
height are illegal values.
java.lang.ArrayIndexOutOfBoundsException - The number of pixels provided by the
caller is not enough for the width * height.
void setValue(int numValues,
int[] value)
numValues - The number of valid elements in valuevalue - The value to use
java.lang.IllegalArgumentException - The number of components or width/
height are illegal values.
java.lang.ArrayIndexOutOfBoundsException - The number of pixels provided by the
caller is not enough for the width * height.
void setImage(java.awt.image.RenderedImage[] img)
throws InvalidOperationTimingException,
InvalidFieldValueException,
InvalidWritableFieldException,
InvalidFieldException
img - The new images to use as the source
InvalidOperationTimingException
InvalidFieldValueException
InvalidWritableFieldException
InvalidFieldException
|
Xj3D 2.0 VRML/X3D Code API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||