public class MFImageObject extends X3DConcreteField implements MFImage
SFImageObject| Modifier and Type | Field and Description |
|---|---|
static int[] |
DEFAULT_VALUE
Default value for this field type is an empty array.
|
static java.lang.String |
DEFAULT_VALUE_STRING
Default string value for this field type is "".
|
static java.lang.String |
NAME
String constant NAME provides name of this element: MFImage
|
static java.util.regex.Pattern |
PATTERN
Precompiled regular expression (regex) pattern for this field type using default REGEX value.
|
static java.lang.String |
REGEX
Default regular expression (regex) pattern for this field type is \s*(([+]?
|
static int |
TUPLE_SIZE
Default tuple size for this field type is 1 (i.e. number of component values making up a single-field SF object).
|
validationResult| Constructor and Description |
|---|
MFImageObject()
Constructor for MFImageObject performs value initialization.
|
MFImageObject(int[] newValue)
Constructor for MFImageObject using a corresponding Java primitive int[] array as new initial value.
|
MFImageObject(MFImageObject newValue)
Constructor to copy an MFImageObject value as initial value for this new field object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
append(java.awt.image.RenderedImage[] newValue)
Places a new SFImage value at the end of the existing value array, increasing the field length accordingly.
|
void |
clear()
Removes all values in the field array, changing the array size to zero.
|
int |
getComponents(int imageIndex)
Get the number of color components in the image.
|
int |
getHeight(int imageIndex)
Get the height of the image array.
|
java.awt.image.WritableRenderedImage |
getImage(int imageIndex)
Fetch the Java representation of the underlying image from these pixels.
|
void |
getPixels(int imageIndex,
int[] pixels)
Get the image pixel value in the given eventOut.
|
int[] |
getPrimitiveValue()
Provides current value of the field as a Java primitive type.
|
int |
getWidth(int imageIndex)
Get the width of the image array.
|
void |
initialize()
Initialization for MFImageObject applies default initial value.
|
void |
insertValue(int index,
java.awt.image.RenderedImage newValue)
Insert a new value prior to the index location in the existing value array, increasing the field length accordingly.
|
boolean |
isDefaultValue()
Determine whether current value matches DEFAULT_VALUE
|
boolean |
matches()
Test PATTERN match via regular expression (regex) check of current object's toString() value.
|
static boolean |
matches(java.lang.String value)
Test PATTERN match with regular expression (regex) of provided value.
|
void |
remove(int index)
Remove one SFImage element of the field array at index position, if found.
|
void |
set1Value(int imageIndex,
int newValue)
Replace a single value at the appropriate location in the existing value array.
|
void |
set1Value(int imageIndex,
int width,
int height,
int components,
int[] pixels) |
void |
setImage(int imageIndex,
java.awt.image.RenderedImage image)
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[] image) |
void |
setSubImage(int imageIndex,
java.awt.image.RenderedImage image,
int sourceWidth,
int sourceHeight,
int sourceXOffset,
int sourceYOffset,
int destinationXOffset,
int destinationYOffset)
Copy a region of the argument RenderedImage to replace a portion of the
current SFimage.
|
void |
setValue(int[] newValue)
Assign a new value array; can be an SFImage primive array containing width, height, and components count, followed by array of pixels.
|
MFImageObject |
setValue(MFImageObject newValue)
Apply an MFImageObject value to this field.
|
void |
setValue(SFImageObject newValue)
Assign a new value array; can be an SFImage primive array containing width, height, and components count, followed by array of pixels.
|
MFImageObject |
setValueByString(java.lang.String newValue)
Utility accessor for MFImageObject using String value (which must pass parsing validation checks).
|
int |
size()
Get the size of the underlying data array.
|
java.lang.String |
toString()
Provides current value as a String.
|
static java.lang.String |
toString(int[] value)
Static utility method to provide String representation of a correctly typed input value.
|
java.lang.String |
toStringDecimal()
Provide pixel values in decimal format.
|
java.lang.String |
toStringHexadecimal()
Provide pixel values in hexadecimal format.
|
java.lang.String |
validate()
Validate current value via regular expression (regex) check of current object's toString() value, reporting errors only if found.
|
addX3DEventListener, getDefinition, getTupleSize, getValidationResult, isReadable, isWritable, removeX3DEventListener, setReadable, setWritableclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddX3DEventListener, getDefinition, isReadable, isWritable, removeX3DEventListenerpublic static final java.lang.String NAME
public static final int[] DEFAULT_VALUE
public static final java.lang.String DEFAULT_VALUE_STRING
public static final int TUPLE_SIZE
public static final java.lang.String REGEX
public static final java.util.regex.Pattern PATTERN
REGEX,
matches(),
matches(String),
validate(),
java.util.regex.Patternpublic MFImageObject()
public MFImageObject(MFImageObject newValue)
newValue - The newValue to applypublic MFImageObject(int[] newValue)
newValue - is new value to assign
setContainerFieldOverride(containerFieldName); // apply checksConcreteField#getTupleSize(String)public void initialize()
initialize in class X3DConcreteFieldDEFAULT_VALUEpublic final java.lang.String validate()
REGEX,
PATTERN,
matches(),
matches(String),
validate(),
java.util.regex.Patternpublic final boolean matches()
REGEX,
PATTERN,
matches(),
matches(String),
validate(),
java.util.regex.Patternpublic static final boolean matches(java.lang.String value)
value - String to check against regex pattern for successful matchREGEX,
PATTERN,
matches(),
matches(String),
validate(),
java.util.regex.Patternpublic MFImageObject setValueByString(java.lang.String newValue) throws InvalidFieldValueException
newValue - is new value to assign, if empty then assign DEFAULT_VALUEMFMatrix4dObject - namely this same object to allow sequential method pipelining (i.e. consecutive
method invocations on the same node object).InvalidFieldValueExceptionX3DLoaderObject.toX3dObjectTree(org.w3c.dom.Node)public static java.lang.String toString(int[] value)
value - The value to convert to a Stringpublic int[] getPrimitiveValue()
public java.lang.String toString()
toString in class java.lang.ObjecttoStringHexadecimal(),
toStringDecimal(),
ConfigurationProperties.SFImagePixelOutputHexadecimal_DEFAULT,
ConfigurationProperties.isSFImagePixelOutputHexadecimal(),
ConfigurationProperties.setSFImagePixelOutputHexadecimal(boolean)public java.lang.String toStringDecimal()
toStringHexadecimal(),
ConfigurationProperties.SFImagePixelOutputHexadecimal_DEFAULT,
ConfigurationProperties.isSFImagePixelOutputHexadecimal(),
ConfigurationProperties.setSFImagePixelOutputHexadecimal(boolean),
X3D Tooltips: type MFImagepublic java.lang.String toStringHexadecimal()
toStringDecimal(),
ConfigurationProperties.SFImagePixelOutputHexadecimal_DEFAULT,
ConfigurationProperties.isSFImagePixelOutputHexadecimal(),
ConfigurationProperties.setSFImagePixelOutputHexadecimal(boolean),
X3D Tooltips: type MFImagepublic int getWidth(int imageIndex)
public int getHeight(int imageIndex)
public int getComponents(int imageIndex)
getComponents in interface MFImageimageIndex - the index of the selected imagepublic void getPixels(int imageIndex,
int[] pixels)
The number of items in the pixels array will be
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.
1 Component Images
The integer has the intensity value stored in the lowest byte and can be
obtained:
intensity = (pixel[i] ) &0xFF;
2 Component Images
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;
3 Component Images
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;
4 Component Images
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;
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.
public java.awt.image.WritableRenderedImage getImage(int imageIndex)
public void setImage(int imageIndex,
java.awt.image.RenderedImage image)
public void setSubImage(int imageIndex,
java.awt.image.RenderedImage image,
int sourceWidth,
int sourceHeight,
int sourceXOffset,
int sourceYOffset,
int destinationXOffset,
int destinationYOffset)
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).
setSubImage in interface MFImageimageIndex - the index of the selected imageimage - The new image to use as the sourcesourceWidth - The width of the argument sub-image region to copysourceHeight - The height of the argument sub-image region to copysourceXOffset - The initial x dimension (width) offset into the
argument sub-image that begins the region to copysourceYOffset - The initial y dimension (height) offset into the
argument sub-image that begins the region to copydestinationXOffset - The initial x dimension (width) offset in the SFimage
object that begins the region to receive the copydestinationYOffset - The initial y dimension (height) offset in the SFimage
object that begins the region to receive the copypublic void set1Value(int imageIndex,
int newValue)
public void set1Value(int imageIndex,
int width,
int height,
int components,
int[] pixels)
public void setValue(int[] newValue)
public void setValue(SFImageObject newValue)
newValue - the newValue to setpublic void setImage(java.awt.image.RenderedImage[] image)
public void append(java.awt.image.RenderedImage[] newValue)
public void insertValue(int index,
java.awt.image.RenderedImage newValue)
insertValue in interface MFImageindex - The position for the inserted value in the current arraynewValue - The newValue to insertpublic void remove(int index)
public void clear()
public int size()
public MFImageObject setValue(MFImageObject newValue)
newValue - The newValue to applyMFImageObject - namely this same object to allow sequential method pipelining (i.e. consecutive method invocations on the same object).public boolean isDefaultValue()
DEFAULT_VALUECopyright ©2005-2017 Web3D Consortium under an open-source license, free for any use. Feedback is welcome.