Package com.openinventor.inventor
Class SbColor
java.lang.Object
com.openinventor.inventor.SbBasic
com.openinventor.inventor.SbVec3f
com.openinventor.inventor.SbColor
Color vector class.
This class is used to represent an RGB color. Each component of the vector is a floating-point number between 0.0 and 1.0. There are routines to convert back and forth between RGB and HSV.
- See Also:
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloat[]
Returns an array of 3 HSV components.int
Calls getPackedValue((float)0.0).int
getPackedValue
(float transparency) Returns an RGBA packed color value, derived from the color vector and the passed transparency value.int
Calls getPackedValueEndiannessOrder((float)0.0).int
getPackedValueEndiannessOrder
(float transparency) Returns an RGBA packed color value, derived from the color vector and the passed transparency value.int
Deprecated.int
getPackedValueInternal
(float transparency) Deprecated.As of Open Inventor 9.5.0.0.float[]
getValue()
setHSVValue
(float[] hsv) Sets value of color vector from array of 3 HSV components.setHSVValue
(float h, float s, float v) Sets value of color vector from 3 HSV (Hue, Saturation, and Value) components.setPackedValue
(int orderedRGBA, float transparency) Sets value of color vector from an RGBA packed color value.setPackedValue
(long rgba, float[] transparency) RGBA Packed integer color routines.void
setRGBValue
(byte r, byte g, byte b) Set RGB values as unsigned char.setValue
(float[] components) setValue
(float[] components, int startIndex) void
static SbColor[]
toArray
(long nativeArray, long length) Methods inherited from class com.openinventor.inventor.SbVec3f
add, cross, divide, dot, equals, equals, getClosestAxis, getValueAt, getX, getY, getZ, length, lengthSquared, minus, multiply, multiply, negate, normalize, over, plus, setValue, setValue, setValue, setValue, setValueAt, setX, setY, setZ, substract, times, times
-
Constructor Details
-
SbColor
-
SbColor
-
SbColor
public SbColor(float[] components) -
SbColor
Constructor that takes a vector value. -
SbColor
public SbColor()Default constructor. The color value is not initialized. -
SbColor
public SbColor(float r, float g, float b) Constructor that takes 3 floats.
-
-
Method Details
-
setPackedValue
RGBA Packed integer color routines.- Parameters:
rgba
- The color format expressed in hexadecinal is 0xrrggbbaa, where aa is the alpha value, bb is the blue value, gg is the green value and rr is the red value.transparency
- is an array which first component will contain the transparency value, after return. You just need to pass a one element float array.
-
toAWTColor
-
getPackedValue
public int getPackedValue()Calls getPackedValue((float)0.0). -
getPackedValueInternal
Deprecated.Calls getPackedValueInternal((float)0.0). -
getPackedValueEndiannessOrder
public int getPackedValueEndiannessOrder()Calls getPackedValueEndiannessOrder((float)0.0). -
setValue
-
setValue
-
setValue
-
getValue
public float[] getValue() -
getHSVValue
public float[] getHSVValue()Returns an array of 3 HSV components. -
toArray
-
getPackedValue
public int getPackedValue(float transparency) Returns an RGBA packed color value, derived from the color vector and the passed transparency value. The alpha component is set to (1.0 - transparency) * 255, resulting in a hex value between 0 and 0xFF. If transparency not specified, alpha is set to 0xFF (opaque). The color format expressed in hexadecimal is 0xrrggbbaa. -
setRGBValue
public void setRGBValue(byte r, byte g, byte b) Set RGB values as unsigned char. RGB values range from 0 to 0xFF (255) -
setPackedValue
Sets value of color vector from an RGBA packed color value. The packed color format expressed in hexadecimal is 0xrrggbbaa, where- rr is the red value
- gg is the green value
- bb is the blue value
- aa is the alpha value
RGBA component values range from 0 to 0xFF (255). The returned transparency value is a floating point value between 0.0 (opaque) and 1.0 (completely transparent). It is derived from the alpha component of the RGBA color.
-
setHSVValue
Sets value of color vector from array of 3 HSV components. -
getPackedValueInternal
Deprecated.As of Open Inventor 9.5.0.0. Use getPackedValueendiannessOrder(float transparency = 0.0) const instead.Warning Deprecated since Open Inventor 9500. Use getPackedValueendiannessOrder(float transparency = 0.0) const instead.
-
getPackedValueEndiannessOrder
public int getPackedValueEndiannessOrder(float transparency) Returns an RGBA packed color value, derived from the color vector and the passed transparency value. The alpha component is set to (1.0 - transparency) * 255, resulting in a hex value between 0 and 0xFF. If transparency not specified, alpha is set to 0xFF (opaque).This method takes "endianness" in account and will return a value according to the processor architecture. For example, on "little-endian" processors like Intel, the color value returned is actually 0xaabbggrr. See the note in
SoVolumeData
about constructing RGBA voxel values programmatically. -
setHSVValue
Sets value of color vector from 3 HSV (Hue, Saturation, and Value) components. Value is the same as brightness of the color.
-