public class SoSFImage3 extends SoSField
Images can be grayscale (intensity), grayscale with transparency information, RGB, or RGB with transparency. Each component of the image (intensity, red, green, blue or transparency (alpha)) can have an unsigned one-byte value from 0 to 255.
Values are returned as arrays of unsigned chars. The image is stored in this array starting at the bottom left front corner of the image with the intensity or red component of that pixel, followed by either the alpha, the green and blue, or the green, blue and alpha components (depending on the number of components in the image). The next value is the first component of the next pixel to the right.
SoSFImage3s are written to file as four integers representing the width, height, depth and number of components in the image, followed by width*height*depth hexadecimal values representing the pixels in the image, separated by whitespace. A one-component image will have one-byte hexadecimal values representing the intensity of the image. For example, 0xFF is full intensity, 0x00 is no intensity. A two-component image puts the intensity in the first (high) byte and the transparency in the second (low) byte. Pixels in a three-component image have the red component in the first (high) byte, followed by the green and blue components (so 0xFF0000 is red). Four-component images put the transparency byte after red/green/blue (so 0x0000FF80 is semi-transparent blue). Note: each pixel is actually read as a single unsigned number, so a 3-component pixel with value "0x0000FF" can also be written as "0xFF" or "255" (decimal).
For example,
is a 1 pixel wide by 2 pixel high by 3 pixel deep grayscale image, with the bottom pixel white and the top pixel black in the first (front-most) slice. In the second slice the bottom pixel is black and the top pixel is white. And:1 2 3 1 0xFF 0x00 0x00 0xFF 0xFF 0x00
is a 2 pixel wide by 4 pixel high by 3 pixel deep RGB image, with the bottom left pixel red, the bottom right pixel green, the two middle rows of pixels black, the top left pixel white, and the top right pixel yellow in the first slice. Subsequent slices are not shown.2 4 3 3 0xFF0000 0xFF00 0 0 0 0 0xFFFFFF 0xFFFF00 ...
See also:
Modifier and Type | Class and Description |
---|---|
static class |
SoSFImage3.BufferObject |
static class |
SoSFImage3.CopyPolicies
SoSFImage3 may be manipulating some large amounts of memory. |
static class |
SoSFImage3.SubTextureImage |
static class |
SoSFImage3.TextureImage |
SoField.FieldTypes
Inventor.ConstructorCommand
Modifier and Type | Field and Description |
---|---|
static int |
COPY
Deprecated.
Use
SoSFImage3.CopyPolicies.COPY instead. |
static int |
NO_COPY
Deprecated.
Use
SoSFImage3.CopyPolicies.NO_COPY instead. |
VERBOSE_LEVEL, ZeroHandle
Constructor and Description |
---|
SoSFImage3()
Deprecated.
As of Open Inventor 9.3 Use constructor with SoFieldContainer instead.
|
SoSFImage3(SoFieldContainer fieldContainer,
java.lang.String fieldName,
SoField.FieldTypes fieldType)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
SoSFImage3.BufferObject |
getBufferObject()
Returns the pixels in the image as a buffer object.
|
int |
getNumComponents()
Returns the pixels in the image as an array of unsigned chars.
|
int |
getNumSubTextures()
Returns true if subTextures have been defined or false if none have been defined.
|
SoSFImage3.SubTextureImage |
getSubTexture(int index)
Returns a buffer to a given subTexture set by setSubValue or setSubValues.
|
SoSFImage3.TextureImage |
getValue()
Returns the pixels in the image as an array of unsigned chars.
|
boolean |
isNeverWrite()
As this field may have to handle large amounts of data and its representation in an .iv file is not very efficient, it is often a good idea not to allow that data to be written out when required by a write action.
|
void |
setNeverWrite(boolean neverWrite)
As this field may have to handle large amounts of data and its representation in an .iv file is not very efficient, it is often a good idea not to allow that data to be written out when required by a write action.
|
void |
setValue(SbVec3s size,
int nc,
SoBufferObject bufferObject)
Calls setValue(size, nc, bufferObject, SoSFImage3.CopyPolicies.valueOf( SoSFImage3.CopyPolicies.COPY.getValue() )).
|
void |
setValue(SbVec3s size,
int nc,
SoBufferObject bufferObject,
SoSFImage3.CopyPolicies copy) |
appendConnection, appendConnection, appendConnection, connectFrom, connectFrom, connectFrom, disconnect, disconnect, disconnect, disconnect, enableConnection, get, getConnectedEngine, getConnectedField, getConnectedVRMLInterp, getContainer, getNumConnections, isConnected, isConnectedFromEngine, isConnectedFromField, isConnectedFromVRMLInterp, isConnectionEnabled, isDefault, isIgnored, set, setIgnored, touch
dispose, getAddress, getNativeResourceHandle, startInternalThreads, stopInternalThreads
@Deprecated public static final int COPY
SoSFImage3.CopyPolicies.COPY
instead.@Deprecated public static final int NO_COPY
SoSFImage3.CopyPolicies.NO_COPY
instead.@Deprecated public SoSFImage3()
public SoSFImage3(SoFieldContainer fieldContainer, java.lang.String fieldName, SoField.FieldTypes fieldType)
public void setValue(SbVec3s size, int nc, SoBufferObject bufferObject)
public SoSFImage3.SubTextureImage getSubTexture(int index)
public int getNumComponents()
public void setNeverWrite(boolean neverWrite)
public SoSFImage3.BufferObject getBufferObject()
public boolean isNeverWrite()
public SoSFImage3.TextureImage getValue()
public void setValue(SbVec3s size, int nc, SoBufferObject bufferObject, SoSFImage3.CopyPolicies copy)
public int getNumSubTextures()
Generated on January 23, 2025, Copyright © Thermo Fisher Scientific. All rights reserved. http://www.openinventor.com