Class SoMFColorRGBA


  • public class SoMFColorRGBA
    extends SoMField
    Multiple-value field containing any number of RGBA colors stored as four floats. A multiple-value field that contains any number of RGBA colors, stored as instances of 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:

       [ 1.0 0.0 0.0 0.5, 0 1 0 1, 0 0 1 .25 ]
    represents the three colors half transparent red, fully opeque green, and one quarter transparent blue.

    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:
    SbColorRGBA
    • Method Detail

      • setValues

        @Deprecated(since="9.3.1")
        public void setValues​(int start,
                              int num,
                              float[] rgba)
        Deprecated.
        As of Open Inventor 9.3.1, use setValues(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

        public int find​(SbColorRGBA targetValue)
        Calls find(targetValue, false).
      • getValues

        public SbColorRGBA[] getValues​(int start)
        Returns a pointer into the array of values in the field, starting at index start. The values are read-only. See the startEditing()/finishEditing() methods for a way of modifying values in place.
      • set1Value

        public void set1Value​(int index,
                              SbColorRGBA newValue)
        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

        public int find​(SbColorRGBA targetValue,
                        boolean addIfNotFound)
        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

        public java.nio.FloatBuffer 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 between startEditing() and finishEditing() (e.g. set1Value(), setValue(), etc.). Fields, engines or sensors connected to this field and sensors are not notified that this field has changed until finishEditing() is called. Calling finishEditing() always sets the isDefault() flag to false and informs engines and sensors that the field changed, even if none of the values actually were changed.
      • setValues

        public void setValues​(int start,
                              SbColorRGBA[] newValues)
        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. See startEditing().
      • getDirectValues

        public java.nio.FloatBuffer getDirectValues​(int start)
        Returns a pointer into the array of values in the field, starting at index start. The values are read-only. See the startEditing()/finishEditing() methods for a way of modifying values in place.
      • getValueAt

        public SbColorRGBA getValueAt​(int i)
      • setValue

        public void setValue​(SbColorRGBA newValue)
        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

        public void setValuesBuffer​(java.nio.ByteBuffer userData)
        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

        public void set1Value​(int index,
                              SbVec4f vec)
        Sets one of N RGBA colors from SbVec4f. 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

        public void setValue​(SbVec4f vec)
        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

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class SoField
      • 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.