public class SoSFImage extends SoSField
Values are returned as arrays of unsigned chars. The image is stored in this array starting at the bottom left 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.
SoSFImages are written to file as three integers representing the width, height and number of components in the image, followed by width*height 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 grayscale image, with the bottom pixel white and the top pixel black. And:1 2 1 0xFF 0x00
is a 2 pixel wide by 4 pixel high 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.2 4 3 0xFF0000 0xFF00 0 0 0 0 0xFFFFFF 0xFFFF00
See also:
Modifier and Type | Class and Description |
---|---|
static class |
SoSFImage.CopyPolicies
SoSFImage may be manipulating some large amounts of memory. |
static class |
SoSFImage.DataTypes
Encoding data type.
|
static class |
SoSFImage.SubTextureImage |
static class |
SoSFImage.TextureImage |
SoField.FieldTypes
Inventor.ConstructorCommand
Modifier and Type | Field and Description |
---|---|
static int |
COPY
Deprecated.
Use
SoSFImage.CopyPolicies.COPY instead. |
static int |
FLOAT
Deprecated.
Use
SoSFImage.DataTypes.FLOAT instead. |
static int |
NO_COPY
Deprecated.
Use
SoSFImage.CopyPolicies.NO_COPY instead. |
static int |
SIGNED_BYTE
Deprecated.
Use
SoSFImage.DataTypes.SIGNED_BYTE instead. |
static int |
SIGNED_INT32
Deprecated.
Use
SoSFImage.DataTypes.SIGNED_INT32 instead. |
static int |
SIGNED_SHORT
Deprecated.
Use
SoSFImage.DataTypes.SIGNED_SHORT instead. |
static int |
UNSIGNED_BYTE
Deprecated.
Use
SoSFImage.DataTypes.UNSIGNED_BYTE instead. |
static int |
UNSIGNED_INT32
Deprecated.
Use
SoSFImage.DataTypes.UNSIGNED_INT32 instead. |
static int |
UNSIGNED_SHORT
Deprecated.
Use
SoSFImage.DataTypes.UNSIGNED_SHORT instead. |
VERBOSE_LEVEL, ZeroHandle
Constructor and Description |
---|
SoSFImage()
Deprecated.
As of Open Inventor 9.3 Use constructor with SoFieldContainer instead.
|
SoSFImage(SoFieldContainer fieldContainer,
java.lang.String fieldName,
SoField.FieldTypes fieldType)
Default constructor.
|
SoSFImage(SoSFImage obj)
Deprecated.
As of Open Inventor 9.3 Use constructor with SoFieldContainer instead.
|
SoSFImage(SoSFImage obj,
SoFieldContainer fieldContainer,
java.lang.String fieldName,
SoField.FieldTypes fieldType)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
int |
getNumSubTextures()
Returns true if subTextures have been defined or false if none have been defined.
|
SoSFImage.SubTextureImage |
getSubTexture(int index) |
SoSFImage.TextureImage |
getValue() |
boolean |
hasTransparency()
Returns true if the image contains any transparent pixels.
|
boolean |
isNeverWrite()
Queries the "neverWrite" flag.
|
void |
setNeverWrite(boolean neverWrite)
Sets the "neverWrite" flag.
|
void |
setValue(SbVec2i32 size,
int nc,
byte[] bytes) |
void |
setValue(SbVec2i32 size,
int nc,
SoSFImage.DataTypes dataType,
SoBufferObject bufferObject)
Calls setValue(size, nc, dataType, bufferObject, SoSFImage.CopyPolicies.valueOf( SoSFImage.CopyPolicies.COPY.getValue() )).
|
void |
setValue(SbVec2i32 size,
int nc,
SoSFImage.DataTypes dataType,
SoBufferObject bufferObject,
SoSFImage.CopyPolicies copy) |
void |
setValue(SbVec2s size,
int nc,
byte[] bytes)
Same as above.
|
void |
setValue(SbVec2s size,
int nc,
SoSFImage.DataTypes dataType,
SoBufferObject bufferObject)
Calls setValue(size, nc, dataType, bufferObject, SoSFImage.CopyPolicies.valueOf( SoSFImage.CopyPolicies.COPY.getValue() )).
|
void |
setValue(SbVec2s size,
int nc,
SoSFImage.DataTypes dataType,
SoBufferObject bufferObject,
SoSFImage.CopyPolicies copy) |
SbRasterImage |
toRasterImage()
Calls toRasterImage((boolean)true).
|
SbRasterImage |
toRasterImage(boolean downSample)
Returns an instance of
SbRasterImage filled with the content of this field. |
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 UNSIGNED_BYTE
SoSFImage.DataTypes.UNSIGNED_BYTE
instead.@Deprecated public static final int UNSIGNED_SHORT
SoSFImage.DataTypes.UNSIGNED_SHORT
instead.@Deprecated public static final int UNSIGNED_INT32
SoSFImage.DataTypes.UNSIGNED_INT32
instead.@Deprecated public static final int SIGNED_BYTE
SoSFImage.DataTypes.SIGNED_BYTE
instead.@Deprecated public static final int SIGNED_SHORT
SoSFImage.DataTypes.SIGNED_SHORT
instead.@Deprecated public static final int SIGNED_INT32
SoSFImage.DataTypes.SIGNED_INT32
instead.@Deprecated public static final int FLOAT
SoSFImage.DataTypes.FLOAT
instead.@Deprecated public static final int COPY
SoSFImage.CopyPolicies.COPY
instead.@Deprecated public static final int NO_COPY
SoSFImage.CopyPolicies.NO_COPY
instead.@Deprecated public SoSFImage()
@Deprecated public SoSFImage(SoSFImage obj)
public SoSFImage(SoFieldContainer fieldContainer, java.lang.String fieldName, SoField.FieldTypes fieldType)
public SoSFImage(SoSFImage obj, SoFieldContainer fieldContainer, java.lang.String fieldName, SoField.FieldTypes fieldType)
public SbRasterImage toRasterImage()
public void setValue(SbVec2i32 size, int nc, SoSFImage.DataTypes dataType, SoBufferObject bufferObject)
public void setValue(SbVec2s size, int nc, SoSFImage.DataTypes dataType, SoBufferObject bufferObject)
public SoSFImage.TextureImage getValue()
public void setNeverWrite(boolean neverWrite)
public SoSFImage.SubTextureImage getSubTexture(int index)
public int getNumSubTextures()
public boolean hasTransparency()
public SbRasterImage toRasterImage(boolean downSample)
SbRasterImage
filled with the content of this field.
It is useful to save the result of an SoRenderToTexture operation in feedback mode. The caller is responsible of the release of the returned raster image.
When the content is not of type UNSIGNED_BYTE the data is downsampled to UNSIGNED_BYTE unless the downSample parameter is set to false.
Returns NULL if the content cannot be converted to an SbRasterImage
.
public void setValue(SbVec2i32 size, int nc, byte[] bytes)
public void setValue(SbVec2s size, int nc, SoSFImage.DataTypes dataType, SoBufferObject bufferObject, SoSFImage.CopyPolicies copy)
public boolean isNeverWrite()
public void setValue(SbVec2s size, int nc, byte[] bytes)
public void setValue(SbVec2i32 size, int nc, SoSFImage.DataTypes dataType, SoBufferObject bufferObject, SoSFImage.CopyPolicies copy)
Generated on January 23, 2025, Copyright © Thermo Fisher Scientific. All rights reserved. http://www.openinventor.com