SbColor(3IV)NAMESbColor (SbCol) - color vector class
INHERITS FROM
SbVec3f > SbColorSYNOPSIS
#include <Inventor_c/SbColor.h>
typedef SbColor SbCol
Functions from class SbColor:
SbColor * SbColSetH_S_V(SbCol *this, float h, float s, float v)
SbColor * SbColSetHSV(SbCol *this, const float hsv[3])
void SbColGetH_S_V(const SbCol *this, float *h, float *s,
float *v)
void SbColGetHSV(const SbCol *this, float hsv[3])
SbColor * SbColSetPacked(SbCol *this, uint32_t rgba, float*
transparency)
uint32_t SbColGetPacked(const SbCol *this, float transparency
= 0.0)
Functions from class SbVec3f:
SbVec3f SbColCross(const SbCol *this, const SbVec3f *v)
SbBool SbColEquals(const SbCol *this, const SbVec3f v, float
tolerance)
SbVec3f SbColGetClosestAxis(const SbCol *this)
float SbColNorm(SbCol *this)
int SbColIsEq(SbCol *this, const SbVec3f *v1, const
SbVec3f *v2)
int SbColIsNEq(SbCol *this, const SbVec3f *v1, const
SbVec3f *v2)
Macros from class SbColor:
SbColGetRGB(float array[3], SbVec3f src)
SbColGetR_G_B(float r, float g, float b, _src)
SbColSetRGB(SbVec3f dest, float src[3])
SbColSetR_G_B(SbVec3f dest, float r, float g, float b)
SbColMult(SbVec3f clr, float s)
SbColDiv(SbVec3f clr, float s)
SbColAdd(SbVec3f dest, SbVec3f clr1, SbVec3f clr2)
SbColSub(SbVec3f dest, SbVec3f clr1, SbVec3f clr2)
Macros from class SbVec3f:
SbV3fDot(SbVec3f vec0, SbVec3f vec1)
SbV3fGetXYZ(float array[3], SbVec3f vec)
SbV3fGetX_Y_Z(float x, float y, float z, SbVec3f vec)
SbV3fLen(SbVec3f vec)
Page 1SbColor(3IV)
SbV3fNegate(SbVec3f vec)
SbV3fSetXYZ(SbVec3f vec, float array[3])
SbV3fSetX_Y_Z(SbVec3f vec, float x, float y, float z)
SbV3fMultBy(SbVec3f vec, float scalar)
SbV3fDivBy(SbVec3f vec, float scalar)
SbV3fAdd(SbVec3f dest, SbVec3f src1, SbVec3f src2)
SbV3fSub(SbVec3f dest, SbVec3f src1, SbVec3f src2)
DESCRIPTION
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. Note that this object
does not have Create or Delete functions. It is considered a simple
datatype and should be declared and/or malloc'd as a simple C struct:
/* This is defined in Inventor_c/SbColor.h: */
struct SbColor {
float rgb[3];
};
typedef SbColor SbCol;
/* This is what your code should look like: */
SbCol c1, c2;
/* The next two lines show two ways to edit the color. */
c1.rgb[0] = 1.0; c1.rgb[1] = 0.0; c1.rgb[2] = 1.0;
SbColSetR_G_B( c2, 1.0, 0.0, 1.0 );
NOTE: No constructors/destructor for C-api.
FUNCTIONSSbColor * SbColSetH_S_V(SbCol *this, 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.
SbColor * SbColSetHSV(SbCol *this, const float hsv[3])
Sets value of color vector from array of 3 HSV components
void SbColGetH_S_V(const SbCol *this, float *h, float *s,
float *v)
Returns 3 individual HSV components
void SbColGetHSV(const SbCol *this, float hsv[3])
Returns an array of 3 HSV components
SbColor * SbColSetPacked(SbCol *this, uint32_t rgba, float*
transparency)
Sets value of color vector from an RGBA packed color value. The
packed color format expressed in hexadecimal is 0xrrggbbaa, where
Page 2SbColor(3IV)
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.
uint32_t SbColGetPacked(const SbCol *this, float transparency
= 0.0)
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).
MACROS
SbColGetRGB(float array[3], SbVec3f src)
SbColGetR_G_B(float r, float g, float b, _src)
Returns color components.
SbColSetRGB(SbVec3f dest, float src[3])
SbColSetR_G_B(SbVec3f dest, float r, float g, float b)
Sets the color.
SbColMult(SbVec3f clr, float s)
Multiply the color components by a scalar value.
SbColDiv(SbVec3f clr, float s)
Divide the color components by a scalar value.
SbColAdd(SbVec3f dest, SbVec3f clr1, SbVec3f clr2)
Add two colors together.
SbColSub(SbVec3f dest, SbVec3f clr1, SbVec3f clr2)
Subtract clr2 from clr1.
FILE FORMAT/DEFAULTS
Color {
}
SEE ALSO
SbVec3f
Page 3