Open Inventor Release 2024.1.1
 
Loading...
Searching...
No Matches
SbColorRGBA Class Reference

ColorRGBA vector class. More...

#include <Inventor/SbColorRGBA.h>

+ Inheritance diagram for SbColorRGBA:

Public Member Functions

 SbColorRGBA ()
 Default constructor.
 
 SbColorRGBA (const SbVec4f vec4f)
 Constructor that takes an RGBA vector value.
 
 SbColorRGBA (const float rgba[4])
 Constructor that takes an RGBA value as an array of 4 floats.
 
 SbColorRGBA (float r, float g, float b, float a)
 Constructor that takes an RGBA value as 4 floats.
 
 SbColorRGBA (uint32_t orderedRGBA)
 Constructor that takes an RGBA value as a packed color.
 
SbColorRGBAsetPackedValue (uint32_t orderedRGBA)
 Sets value of color vector from an RGBA packed color value.
 
uint32_t getPackedValue () const
 Returns an RGBA packed color value, derived from the color vector.
 
SbColorRGBAsetHSVAValue (float h, float s, float v, float a)
 Sets value of color vector from an HSV (Hue, Saturation, and Value) plus Alpha color value.
 
SbColorRGBAsetHSVAValue (const float hsva[4])
 Sets value of color vector from an HSV (Hue, Saturation, and Value) plus Alpha color value.
 
void getHSVAValue (float &h, float &s, float &v, float &a) const
 Returns color value in the HSV (hue, saturation and value) plus Alpha color space.
 
void getHSVAValue (float hsva[4]) const
 Returns color value in the HSV (hue, saturation and value) plus Alpha color space.
 
- Public Member Functions inherited from SbVec4f
 SbVec4f ()
 Default constructor.
 
 SbVec4f (const float v[4])
 Constructor given vector components.
 
 SbVec4f (float x, float y, float z, float w)
 Constructor given vector components.
 
float dot (const SbVec4f &v) const
 Returns dot (inner) product of vector and another vector.
 
void getReal (SbVec3f &v) const
 Returns the real portion of the vector by dividing by the fourth value.
 
const float * getValue () const
 Returns vector components.
 
void getValue (float &x, float &y, float &z, float &w) const
 Returns vector components.
 
float length () const
 Returns geometric length of vector.
 
float lengthSquared () const
 Returns square length of vector.
 
void negate ()
 Negates each component of vector in place.
 
float normalize ()
 Changes vector to be unit length.
 
SbVec4fsetValue (const float v[4])
 Sets the vector components.
 
SbVec4fsetValue (float x, float y, float z, float w)
 Sets the vector components.
 
SbVec4fsetValue (const SbVec4d &vec4d)
 Sets value of vector from a double precision vector.
 
float & operator[] (int i)
 Accesses indexed component of vector.
 
const float & operator[] (int i) const
 
SbVec4foperator*= (float d)
 Component-wise scalar multiplication operator.
 
SbVec4foperator/= (float d)
 Component-wise scalar division operator.
 
SbVec4foperator+= (const SbVec4f &u)
 Component-wise vector addition operator.
 
SbVec4foperator-= (const SbVec4f &u)
 Component-wise vector subtraction operator.
 
SbVec4f operator- () const
 Nondestructive unary negation - returns a new vector.
 
SbBool equals (const SbVec4f &v, float tolerance) const
 Equality comparison within given tolerance - the square of the length of the maximum distance between the two vectors.
 
template<typename T >
 SbVec4f (const T &v)
 Constructor that converts an arbitrary SbVec4 to an SbVec4f.
 

Detailed Description

ColorRGBA vector class.

This class is used to represent an RGBA color. Each component of the vector is a floating-point number between 0.0 and 1.0. RGBA stands for red, green, blue and alpha. Alpha is the inverse of "transparency", in other words 0 is fully transparent and 1 is fully opaque.

Values may be specified in the HSV (hue, saturation and value) color space, but are stored internally as RGBA values.

SEE ALSO

SbColor, SbVec4f

Definition at line 61 of file SbColorRGBA.h.

Constructor & Destructor Documentation

◆ SbColorRGBA() [1/5]

SbColorRGBA::SbColorRGBA ( )

Default constructor.

The color value is not initialized.

◆ SbColorRGBA() [2/5]

SbColorRGBA::SbColorRGBA ( const SbVec4f  vec4f)
inline

Constructor that takes an RGBA vector value.

Definition at line 71 of file SbColorRGBA.h.

◆ SbColorRGBA() [3/5]

SbColorRGBA::SbColorRGBA ( const float  rgba[4])
inline

Constructor that takes an RGBA value as an array of 4 floats.

Definition at line 77 of file SbColorRGBA.h.

◆ SbColorRGBA() [4/5]

SbColorRGBA::SbColorRGBA ( float  r,
float  g,
float  b,
float  a 
)
inline

Constructor that takes an RGBA value as 4 floats.

Definition at line 83 of file SbColorRGBA.h.

◆ SbColorRGBA() [5/5]

SbColorRGBA::SbColorRGBA ( uint32_t  orderedRGBA)

Constructor that takes an RGBA value as a packed color.

Member Function Documentation

◆ getHSVAValue() [1/2]

void SbColorRGBA::getHSVAValue ( float &  h,
float &  s,
float &  v,
float &  a 
) const

Returns color value in the HSV (hue, saturation and value) plus Alpha color space.

◆ getHSVAValue() [2/2]

void SbColorRGBA::getHSVAValue ( float  hsva[4]) const
inline

Returns color value in the HSV (hue, saturation and value) plus Alpha color space.

Definition at line 139 of file SbColorRGBA.h.

◆ getPackedValue()

uint32_t SbColorRGBA::getPackedValue ( ) const

Returns an RGBA packed color value, derived from the color vector.

The packed color format expressed in hexadecimal is 0xrrggbbaa.

◆ setHSVAValue() [1/2]

SbColorRGBA & SbColorRGBA::setHSVAValue ( const float  hsva[4])
inline

Sets value of color vector from an HSV (Hue, Saturation, and Value) plus Alpha color value.

All components must be in the range 0 to 1.

Definition at line 126 of file SbColorRGBA.h.

◆ setHSVAValue() [2/2]

SbColorRGBA & SbColorRGBA::setHSVAValue ( float  h,
float  s,
float  v,
float  a 
)

Sets value of color vector from an HSV (Hue, Saturation, and Value) plus Alpha color value.

All components must be in the range 0 to 1.

Value is the same as brightness of the color.

◆ setPackedValue()

SbColorRGBA & SbColorRGBA::setPackedValue ( uint32_t  orderedRGBA)

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 documentation for this class was generated from the following file: