Hide menu
Loading...
Searching...
No Matches

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

#include <ModelData_Color.hxx>

Public Types

typedef float value_type
 
typedef float ValueType
 

Public Member Functions

 ModelData_Color (float r, float g, float b, float a=1.f)
 Constructor.
 
 ModelData_Color (int r, int g, int b, int a=255)
 Constructor.
 
 ModelData_Color (int argb)
 Constructor.
 
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

Constructor & Destructor Documentation

◆ ModelData_Color() [1/3]

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() [2/3]

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() [3/3]

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

Constructor.

Creates a color with explicit argb value

Member Function Documentation

◆ operator[]() [1/2]

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

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

◆ operator[]() [2/2]

const value_type & cadex::ModelData_Color::operator[] ( size_t  theIndex) const
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.