Class SoConversion
java.lang.Object
com.openinventor.inventor.Inventor
com.openinventor.inventor.algorithms.SoConversion
Type conversion functions for buffers.
This module provides data type conversions, like bytes to floats...
Examples:
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand
-
Field Summary
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
convert
(SoBufferObject sourceBufferObject, SbDataType src_type, SoBufferObject targetBufferObject, SbDataType dst_type, long size) Convert the data in a buffer object from one data type to another one.int
convert
(SoCpuBufferObject sourceBufferObject, SbDataType src_type, SoCpuBufferObject targetBufferObject, SbDataType dst_type, long size) Convert the data in a buffer object from one data type to another one.int
convertFloatToRGBA
(SoBufferObject sourceBufferObject, SoBufferObject targetBufferObject, long size, float dataMin, float dataMax) Convert FLOAT data stored in a buffer to (grayscale) RGBA data.int
convertFloatToRGBA
(SoCpuBufferObject sourceBufferObject, SoCpuBufferObject targetBufferObject, long size, float dataMin, float dataMax) Convert FLOAT data stored in a buffer to RGBA data.Methods inherited from class com.openinventor.inventor.Inventor
dispose, getNativeResourceHandle
-
Constructor Details
-
SoConversion
public SoConversion()SoConversion
constructor.
-
-
Method Details
-
convertFloatToRGBA
public int convertFloatToRGBA(SoCpuBufferObject sourceBufferObject, SoCpuBufferObject targetBufferObject, long size, float dataMin, float dataMax) Convert FLOAT data stored in a buffer to RGBA data. Fast implementation for CPU buffers. -
convertFloatToRGBA
public int convertFloatToRGBA(SoBufferObject sourceBufferObject, SoBufferObject targetBufferObject, long size, float dataMin, float dataMax) Convert FLOAT data stored in a buffer to (grayscale) RGBA data.- The source and the target buffers can be the same.
- The algorithm maps float values between dataMin and dataMax to the range 0..255.
- The resulting values are clamped to 0..255.
- Parameters:
sourceBufferObject
- The source buffer object containing the FLOAT data.targetBufferObject
- The target buffer object.size
- The number of FLOAT values to convert.dataMin
- The minimum value for the greyscale conversion.dataMax
- The maximum value for the greyscale conversion.- Returns:
- Returns 0 if there were no errors during the process. Returns 1 if one or more buffers don't have the correct size.
-
convert
public int convert(SoCpuBufferObject sourceBufferObject, SbDataType src_type, SoCpuBufferObject targetBufferObject, SbDataType dst_type, long size) Convert the data in a buffer object from one data type to another one.
Fast implementation for CPU buffers. -
convert
public int convert(SoBufferObject sourceBufferObject, SbDataType src_type, SoBufferObject targetBufferObject, SbDataType dst_type, long size) Convert the data in a buffer object from one data type to another one.
Notes: The destination buffer and the source buffers can be same.
Limitations: This function only supports FLOAT and UNSIGNED_BYTE for dst_type.
- Parameters:
sourceBufferObject
- The source buffer object.src_type
- The type of the data in the source buffer object.targetBufferObject
- The destination buffer object.dst_type
- The destination type.size
- The number of elements in the source buffer object to convert.- Returns:
- Returns 0 if there were no errors during the process. Returns 1 if one or more buffers don't have the correct size.
-