Coin
4.0.3
Coin3D core library
|
The SbColor4f class contains the red, green, blue and alpha components which make up a color value. More...
#include <Inventor/SbColor4f.h>
Additional Inherited Members | |
Protected Attributes inherited from SbVec4f | |
float | vec [4] |
Related Symbols inherited from SbVec4f | |
int | operator!= (const SbVec4f &v1, const SbVec4f &v2) |
SbVec4f | operator* (const SbVec4f &v, float d) |
SbVec4f | operator* (float d, const SbVec4f &v) |
SbVec4f | operator+ (const SbVec4f &v1, const SbVec4f &v2) |
SbVec4f | operator- (const SbVec4f &v1, const SbVec4f &v2) |
SbVec4f | operator/ (const SbVec4f &v, float d) |
int | operator== (const SbVec4f &v1, const SbVec4f &v2) |
The SbColor4f class contains the red, green, blue and alpha components which make up a color value.
This class is used internally within other classes in Coin. It contains a 4 component vector as a position in the RGB cube with an additional transparency value.
The red, green and blue values should be between 0.0 and 1.0, where 0.0 is interpreted as minimum intensity, and 1.0 is maximum intensity. The transparency value is also between 0.0 and 1.0.
SbColor4f contains methods for convenient handling of setting and getting color values as 32 bit packed values or as HSV values.
Note: this class is not part of Open Inventor, but is an extension to the API. Don't use it if you want your code to be compatible with Open Inventor.
SbColor4f::SbColor4f | ( | void | ) |
Default constructor. The color value will be uninitialized until explicitly set.
Construct and initialize an SbColor4f with the red, green, blue and alpha values given by the v
vector.
Construct and initialize an SbColor4f with the red, green, blue and alpha taken from given rgba
array
Construct and initialize an SbColor4f with the given red, green, blue and alpha values.
void SbColor4f::getHSVValue | ( | float & | h, |
float & | s, | ||
float & | v ) const |
Return the color as a hue
, saturation
, value
triplet. Alpha component is ignored.
void SbColor4f::getHSVValue | ( | float | hsv[3] | ) | const |
Return the color as a hue
, saturation
, value
triplet. Alpha component is ignored.
uint32_t SbColor4f::getPackedValue | ( | ) | const |
Return color as a 32 bit packed integer in the form 0xRRGGBBAA.
Return pointer to array of 4 float values representing the red, green, blue and transparency values of the color.
void SbColor4f::getValue | ( | float & | r, |
float & | g, | ||
float & | b, | ||
float & | a ) |
Return components of the stored color.
Multiplies the RGB components by d
. The alpha component is left unchanged.
Subtracts the RGB components. Alpha is ignored.
Divides the RGB components by d
. The alpha component is left unchanged.
float & SbColor4f::operator[] | ( | const int | idx | ) |
Returns the color component represented by the given index idx. 0 is red, 1 is green, 2 is blue and 3 is the transparency value.
float SbColor4f::operator[] | ( | const int | idx | ) | const |
Returns the color component represented by the given index idx. 0 is red, 1 is green, 2 is blue and 3 is the transparency value.
Set the color as a hue
, saturation
, value
triplet. The hue component should be normalized to within [0, 1] before you call this method, where a value of 0 corresponds to 0 degrees and a value of 1 corresponds to 360 degrees.
SbColor4f & SbColor4f::setHSVValue | ( | float | hue, |
float | saturation, | ||
float | value, | ||
float | alpha = 1.0f ) |
Set the color as a hue
, saturation
, value
triplet. The hue component should be normalized to within [0, 1] before you call this method, where a value of 0 corresponds to 0 degrees and a value of 1 corresponds to 360 degrees.
Set the color value as a 32 bit combined red/green/blue/alpha value. Each component is 8 bit wide (i.e. from 0x00 to 0xff), and the red value should be stored leftmost, like this: 0xRRGGBBAA.
Sets the RGB components of the color. The alpha component is left unchanged.
Set a new color. The elements of the array will be read in turned as red, green, blue and transparency.
Set a new color.