CAD Exchanger SDK
cadex::ModelData_Color Class Reference

Defines an RGBA color (with alpha channel). More...

Public Types

typedef float value_type
 
typedef float ValueType
 

Public Member Functions

 ModelData_Color ()
 Constructor. More...
 
 ModelData_Color (float r, float g, float b, float a=1.f)
 Constructor. More...
 
 ModelData_Color (int r, int g, int b, int a=255)
 Constructor. More...
 
 ModelData_Color (int argb)
 Constructor. More...
 
float R () const
 
float & R ()
 
float G () const
 
float & G ()
 
float B () const
 
float & B ()
 
float A () const
 Returns alpha-channel.
 
float & A ()
 Returns alpha-channel.
 
const value_type & Value (size_t theIndex) const
 
const value_type & operator[] (size_t theIndex) const
 
value_type & operator[] (size_t theIndex)
 
void SetValue (const value_type &theVal)
 
void SetValue (int theIndex, const value_type &theVal)
 
void Set (float r, float g, float b, float a=1.f)
 Sets individual color components.
 
void Set (int r, int g, int b, int a=255)
 Sets individual color components.
 
bool IsValid () const
 

Static Public Member Functions

static float Precision ()
 

Protected Attributes

ValueType myBuf [4]
 

Detailed Description

Defines an RGBA color (with alpha channel).

Components must be within a [0, 1] range.

Examples:
exploring/polyrepresentation/main.cxx, modeling/assembly/main.cxx, modeling/metadata/main.cxx, modeling/poly/main.cxx, and visualization/qtquick_qml/measurements/main.cxx.

Constructor & Destructor Documentation

◆ ModelData_Color() [1/4]

cadex::ModelData_Color::ModelData_Color ( )
inline

Constructor.

Creates a black color with alpha channel 1.

◆ ModelData_Color() [2/4]

cadex::ModelData_Color::ModelData_Color ( float  r,
float  g,
float  b,
float  a = 1.f 
)
inline

Constructor.

Creates a color with explicit values. Each value must be within [0, 1] range.

◆ ModelData_Color() [3/4]

cadex::ModelData_Color::ModelData_Color ( int  r,
int  g,
int  b,
int  a = 255 
)
inline

Constructor.

Creates a color with explicit values. Each value must be within [0, 255] range.

◆ ModelData_Color() [4/4]

cadex::ModelData_Color::ModelData_Color ( int  argb)
inlineexplicit

Constructor.

Creates a color with explicit argb value

Member Function Documentation

◆ operator[]() [1/2]

const value_type& cadex::ModelData_Color::operator[] ( size_t  theIndex) const
inline

theIndex must be in the [0, n) range.

◆ operator[]() [2/2]

value_type& cadex::ModelData_Color::operator[] ( size_t  theIndex)
inline

theIndex must be in the [0, n) range.

◆ SetValue()

void cadex::ModelData_Color::SetValue ( int  theIndex,
const value_type &  theVal 
)

theIndex must be in the [0, n) range.

◆ Value()

const value_type& cadex::ModelData_Color::Value ( size_t  theIndex) const
inline

theIndex must be in the [0, n) range.