Package com.openinventor.inventor
Class SbColor
- java.lang.Object
-
- com.openinventor.inventor.SbBasic
-
- com.openinventor.inventor.SbVec3f
-
- com.openinventor.inventor.SbColor
-
public class SbColor extends SbVec3f
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:
SbColorRGBA
,SbVec3f
-
-
Constructor Summary
Constructors Constructor Description SbColor()
Default constructor.SbColor(float[] components)
SbColor(float r, float g, float b)
Constructor that takes 3 floats.SbColor(SbColor copyFrom)
SbColor(SbVec3f vec3f)
Constructor that takes a vector value.SbColor(java.awt.Color c)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description float[]
getHSVValue()
Returns an array of 3 HSV components.int
getPackedValue()
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
getPackedValueEndiannessOrder()
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
getPackedValueInternal()
Deprecated.int
getPackedValueInternal(float transparency)
Deprecated.As of Open Inventor 9.5.0.0.float[]
getValue()
SbColor
setHSVValue(float[] hsv)
Sets value of color vector from array of 3 HSV components.SbColor
setHSVValue(float h, float s, float v)
Sets value of color vector from 3 HSV (Hue, Saturation, and Value) components.SbColor
setPackedValue(int orderedRGBA, float transparency)
Sets value of color vector from an RGBA packed color value.SbColor
setPackedValue(long rgba, float[] transparency)
RGBA Packed integer color routines.void
setRGBValue(byte r, byte g, byte b)
Set RGB values as unsigned char.SbColor
setValue(float[] components)
SbColor
setValue(float[] components, int startIndex)
void
setValue(SbColor copyFrom)
static SbColor[]
toArray(long nativeArray, long length)
java.awt.Color
toAWTColor()
-
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 Detail
-
SbColor
public SbColor(java.awt.Color c)
-
SbColor
public SbColor(SbColor copyFrom)
-
SbColor
public SbColor(float[] components)
-
SbColor
public SbColor(SbVec3f vec3f)
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 Detail
-
setPackedValue
public SbColor setPackedValue(long rgba, float[] transparency)
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
public java.awt.Color toAWTColor()
-
getPackedValue
public int getPackedValue()
Calls getPackedValue((float)0.0).
-
getPackedValueInternal
@Deprecated(since="9.5.0.0") public int getPackedValueInternal()
Deprecated.Calls getPackedValueInternal((float)0.0).
-
getPackedValueEndiannessOrder
public int getPackedValueEndiannessOrder()
Calls getPackedValueEndiannessOrder((float)0.0).
-
setValue
public SbColor setValue(float[] components, int startIndex)
-
setValue
public void setValue(SbColor copyFrom)
-
getHSVValue
public float[] getHSVValue()
Returns an array of 3 HSV components.
-
toArray
public static SbColor[] toArray(long nativeArray, long length)
-
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
public SbColor setPackedValue(int orderedRGBA, float transparency)
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
public SbColor setHSVValue(float[] hsv)
Sets value of color vector from array of 3 HSV components.
-
getPackedValueInternal
@Deprecated(since="9.5.0.0") public int getPackedValueInternal(float transparency)
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
public SbColor setHSVValue(float h, float s, float v)
Sets value of color vector from 3 HSV (Hue, Saturation, and Value) components. Value is the same as brightness of the color.
-
-