|
Coin3D is Free Software, published under the BSD 3-clause license. |
https://coin3d.github.io https://www.kongsberg.com/en/kogt/ |
The SbColor class contains the red, green and blue components which make up a color value. More...
#include <Inventor/SbColor.h>
Additional Inherited Members | |
Protected Attributes inherited from SbVec3f | |
| float | vec [3] |
Related Symbols inherited from SbVec3f | |
| SbVec3f | operator* (const SbVec3f &v, float d) |
| SbVec3f | operator* (float d, const SbVec3f &v) |
| SbVec3f | operator/ (const SbVec3f &v, float d) |
| SbVec3f | operator+ (const SbVec3f &v1, const SbVec3f &v2) |
| SbVec3f | operator- (const SbVec3f &v1, const SbVec3f &v2) |
| int | operator== (const SbVec3f &v1, const SbVec3f &v2) |
| int | operator!= (const SbVec3f &v1, const SbVec3f &v2) |
The SbColor class contains the red, green and blue components which make up a color value.
This class is used within other classes in Coin. It inherits the SbVec3f class, interpreting the 3 component vector as a vector in the RGB cube where the red, green and blue components corresponds to x, y and z respectively.
SbColor also adds a few extra methods for convenient handling of setting and getting color values as 32 bit packed values or as HSV values.
| SbColor::SbColor | ( | void | ) |
Default constructor. The color value will be uninitialized.
Construct and initialize an SbColor with the red, green and blue values given by the v vector.
Construct and initialize an SbColor with the red, green and blue taken from given rgb array.
Construct and initialize an SbColor with the given red, green and blue values.
| SbColor & SbColor::setHSVValue | ( | float | hue, |
| float | saturation, | ||
| float | 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.
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.
| void SbColor::getHSVValue | ( | float & | h, |
| float & | s, | ||
| float & | v ) const |
Return the color as a hue, saturation, value triplet.
| void SbColor::getHSVValue | ( | float | hsv[3] | ) | const |
Return the color as a hue, saturation, value triplet.
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.
The transparency value is not stored internally in SbColor, just converted to a transparency value in [0, 1] and returned in the transparency field. A value of 1.0 means completely transparent and a value of 0.0 is completely opaque.
| uint32_t SbColor::getPackedValue | ( | const float | transparency = 0.0f | ) | const |
Return color as a 32 bit packed integer in the form 0xRRGGBBAA. The transparency part of the return value is taken from the supplied transparency argument.