Class SoMFColorRGBA
SbColorRGBA
. RGBA stands for red, green, blue and alpha. Values should be in the range 0 to 1. Alpha is the inverse of "transparency", in other words 0 is fully transparent and 1 is fully opaque.
Values can also be specified or queried in the HSV (hue, saturation and value) color space, but values are stored internally as RGBA values.
SoMFColorRGBAs are written to file as one or more RGBA quadruples of floating point numbers in standard scientific notation. When more than one value is present, all of the values are enclosed in square brackets and separated by commas. For example:
represents the three colors half transparent red, fully opeque green, and one quarter transparent blue.[ 1.0 0.0 0.0 0.5, 0 1 0 1, 0 0 1 .25 ]
Data copying:
SoMF fields are a kind of "smart container", automatically expanding as necessary to hold the data provided by the application. This is very convenient, but for large blocks of data it may be desireable to avoid making a copy of the application data. The setValuesBuffer() methods allow Open Inventor to directly use an array of values supplied by the application. The application data is not copied. Please see SoMFVec3f
for more information and example code.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.openinventor.inventor.fields.SoField
SoField.FieldTypes
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
ConstructorsConstructorDescriptionSoMFColorRGBA
(SoFieldContainer fieldContainer, String fieldName, SoField.FieldTypes fieldType) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Temporary disable value deleting.boolean
int
find
(SbColorRGBA targetValue) Calls find(targetValue, false).int
find
(SbColorRGBA targetValue, boolean addIfNotFound) Finds the given targetValue in the array and returns the index of that value.void
Indicates that batch edits have finished.getDirectValues
(int start) Returns a pointer into the array of values in the field, starting at index start.getValueAt
(int i) getValues
(int start) Returns a pointer into the array of values in the field, starting at index start.void
set1HSVAValue
(int index, float[] hsva) Sets one of N HSV plus Alpha colors from an array of 4 floats.void
set1HSVAValue
(int index, float h, float s, float v, float a) Sets one of N HSV plus Alpha colors from 4 floats.void
set1Value
(int index, float[] rgba) Sets one of N RGBA colors from an array of 4 floats.void
set1Value
(int index, float r, float g, float b, float a) Sets one of N RGBA colors from 4 floats.void
set1Value
(int index, SbColorRGBA newValue) Sets the index'th value in the array to newValue.void
Sets one of N RGBA colors fromSbVec4f
.void
setHSVAValue
(float[] hsva) Sets the field to contain one and only one value, the given color (expressed as an array of HSV plus Alpha floating point values in the range 0.0 to 1.0), and deletes the second and subsequent values.void
setHSVAValue
(float h, float s, float v, float a) Sets the field to contain one and only one value, the given color (expressed as HSV plus Alpha floating point values in the range 0.0 to 1.0), and deletes the second and subsequent values.void
setValue
(float[] rgba) Sets the field to contain one and only one value, the given color (expressed as an array of RGBA floating point values in the range 0.0 to 1.0), and deletes the second and subsequent values.void
setValue
(float r, float g, float b, float a) Sets the field to contain one and only one value, the given color (expressed as RGBA floating point values in the range 0.0 to 1.0), and deletes the second and subsequent values.void
setValue
(SbColorRGBA newValue) Sets the first value in the array to newValue, and deletes.void
Sets the field to contain one and only one value, the given color (expressed as RGBA floating point values in the range 0.0 to 1.0), and deletes the second and subsequent values.void
setValues
(int start, float[] rgba) Sets RGBA values from the specified array of floats.void
setValues
(int start, int num, float[] rgba) Deprecated.void
setValues
(int start, SbColorRGBA[] newValues) Sets num values starting at index start to the values.void
setValuesBuffer
(ByteBuffer userData) Sets the field to contain the values stored in userData.Returns a pointer to the internally maintained array that can be modified.Methods inherited from class com.openinventor.inventor.fields.SoMField
deleteValues, deleteValues, get1, getNum, insertSpace, set1, setNum
Methods inherited from class com.openinventor.inventor.fields.SoField
appendConnection, appendConnection, connectFrom, connectFrom, disconnect, disconnect, disconnect, enableConnection, get, getConnectedEngine, getConnectedField, getContainer, getNumConnections, getValueSize, isConnected, isConnectedFromEngine, isConnectedFromField, isConnectedFromVRMLInterp, isConnectionEnabled, isDefault, isIgnored, set, setIgnored, touch
Methods inherited from class com.openinventor.inventor.Inventor
dispose, getNativeResourceHandle
-
Constructor Details
-
SoMFColorRGBA
public SoMFColorRGBA(SoFieldContainer fieldContainer, String fieldName, SoField.FieldTypes fieldType) Default constructor.
-
-
Method Details
-
setValues
Deprecated.As of Open Inventor 9.3.1, usesetValues(int, float[])
instead.Sets num RGBA values from an array of arrays of 4 floats. Each float should be in the range 0.0 to 1.0, and there must be 4* num total float values. -
find
Calls find(targetValue, false). -
getValues
Returns a pointer into the array of values in the field, starting at index start. The values are read-only. See thestartEditing()
/finishEditing() methods for a way of modifying values in place. -
set1Value
Sets the index'th value in the array to newValue. The array will be automatically expanded, if necessary. In that case, if field's values are stored in an user data array, this array is no more used. -
find
Finds the given targetValue in the array and returns the index of that value. in the array. If the value is not found, -1 is returned. If addIfNotFound is set, then targetValue is added to the end of the array (but -1 is still returned). -
startEditing
Returns a pointer to the internally maintained array that can be modified. The values in the array may be changed, but values cannot be added or removed. It is illegal to call any other editing methods betweenstartEditing()
andfinishEditing()
(e.g.set1Value()
,setValue()
, etc.). Fields, engines or sensors connected to this field and sensors are not notified that this field has changed untilfinishEditing()
is called. CallingfinishEditing()
always sets theisDefault()
flag to false and informs engines and sensors that the field changed, even if none of the values actually were changed. -
setValues
Sets num values starting at index start to the values. in newValues. The array will automatically be made larger to accommodate the new values, if necessary. In that case, if field's values are stored in an user data array, this array is no more used. -
setValues
public void setValues(int start, float[] rgba) Sets RGBA values from the specified array of floats. Each float should be in the range 0.0 to 1.0, and size of the array must be a multiple of 4. -
finishEditing
public void finishEditing()Indicates that batch edits have finished. SeestartEditing()
. -
getDirectValues
Returns a pointer into the array of values in the field, starting at index start. The values are read-only. See thestartEditing()
/finishEditing() methods for a way of modifying values in place. -
getValueAt
-
setValue
Sets the first value in the array to newValue, and deletes. the second and subsequent values. If field's values are stored in an user data array, this array is no more used. -
setValuesBuffer
Sets the field to contain the values stored in userData. This data will not be copied into the field: it will be directly used by the field. -
setHSVAValue
public void setHSVAValue(float[] hsva) Sets the field to contain one and only one value, the given color (expressed as an array of HSV plus Alpha floating point values in the range 0.0 to 1.0), and deletes the second and subsequent values. -
set1Value
Sets one of N RGBA colors fromSbVec4f
. The array will be expanded and filled with zeros as necessary. -
setValue
public void setValue(float r, float g, float b, float a) Sets the field to contain one and only one value, the given color (expressed as RGBA floating point values in the range 0.0 to 1.0), and deletes the second and subsequent values. -
setValue
public void setValue(float[] rgba) Sets the field to contain one and only one value, the given color (expressed as an array of RGBA floating point values in the range 0.0 to 1.0), and deletes the second and subsequent values. -
setHSVAValue
public void setHSVAValue(float h, float s, float v, float a) Sets the field to contain one and only one value, the given color (expressed as HSV plus Alpha floating point values in the range 0.0 to 1.0), and deletes the second and subsequent values. -
set1Value
public void set1Value(int index, float r, float g, float b, float a) Sets one of N RGBA colors from 4 floats. The array will be expanded and filled with zeros as necessary. -
setValue
Sets the field to contain one and only one value, the given color (expressed as RGBA floating point values in the range 0.0 to 1.0), and deletes the second and subsequent values. -
set1HSVAValue
public void set1HSVAValue(int index, float[] hsva) Sets one of N HSV plus Alpha colors from an array of 4 floats. The array will be expanded and filled with zeros as necessary. -
equals
-
disableDeleteValues
public void disableDeleteValues()Temporary disable value deleting. -
set1Value
public void set1Value(int index, float[] rgba) Sets one of N RGBA colors from an array of 4 floats. The array will be expanded and filled with zeros as necessary. -
set1HSVAValue
public void set1HSVAValue(int index, float h, float s, float v, float a) Sets one of N HSV plus Alpha colors from 4 floats. The array will be expanded and filled with zeros as necessary.
-
setValues(int, float[])
instead.