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
VERBOSE_LEVEL, ZeroHandle
Constructor and Description |
---|
SoSFImage(SoFieldContainer fieldContainer,
java.lang.String fieldName,
SoField.FieldTypes fieldType)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
int |
getNumComponents()
Returns image's number of components.
|
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, connectFrom, connectFrom, disconnect, disconnect, disconnect, enableConnection, get, getConnectedEngine, getConnectedField, getContainer, getNumConnections, getValueSize, isConnected, isConnectedFromEngine, isConnectedFromField, isConnectedFromVRMLInterp, isConnectionEnabled, isDefault, isIgnored, set, setIgnored, touch
dispose, getNativeResourceHandle
public SoSFImage(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 void setNeverWrite(boolean neverWrite)
public SoSFImage.SubTextureImage getSubTexture(int index)
public int getNumSubTextures()
public SoSFImage.TextureImage getValue()
public void setValue(SbVec2i32 size, int nc, byte[] bytes)
public void setValue(SbVec2s size, int nc, byte[] bytes)
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 boolean hasTransparency()
public void setValue(SbVec2s size, int nc, SoSFImage.DataTypes dataType, SoBufferObject bufferObject, SoSFImage.CopyPolicies copy)
public boolean isNeverWrite()
public void setValue(SbVec2i32 size, int nc, SoSFImage.DataTypes dataType, SoBufferObject bufferObject, SoSFImage.CopyPolicies copy)
public int getNumComponents()
Generated on July 31, 2019, Copyright © Thermo Fisher Scientific. All rights reserved. http://www.openinventor.com