SOFA API  7736d2b5
Open source framework for multi-physics simuation
sofa::type::RGBAColor Class Reference

#include <RGBAColor.h>

encode a 4 RGBA component color More...

Detailed Description

encode a 4 RGBA component color

Static Public Attributes

static constexpr sofa::Size NumberOfComponents = 4
 
static constexpr sofa::Size static_size = NumberOfComponents
 

Public Member Functions

constexpr RGBAColor ()
 
constexpr RGBAColor (const std::array< float, NumberOfComponents > &c)
 
constexpr RGBAColor (float r, float g, float b, float a)
 
 RGBAColor (const type::fixed_array< float, NumberOfComponents > &c)
 
 RGBAColor (const type::Vec4f &c)
 
constexpr floatr ()
 
constexpr floatg ()
 
constexpr floatb ()
 
constexpr floata ()
 
constexpr const floatr () const
 
constexpr const floatg () const
 
constexpr const floatb () const
 
constexpr const floata () const
 
constexpr void r (const float r)
 
constexpr void g (const float g)
 
constexpr void b (const float b)
 
constexpr void a (const float a)
 
constexpr floatoperator[] (std::size_t i)
 
constexpr const floatoperator[] (std::size_t i) const
 
void set (float r, float g, float b, float a)
 
bool operator== (const RGBAColor &b) const
 
bool operator!= (const RGBAColor &b) const
 
bool operator< (const RGBAColor &b) const
 
RGBAColor operator* (float f) const
 
constexpr const floatdata () const noexcept
 
constexpr const ComponentArrayarray () const noexcept
 direct access to array More...
 
constexpr ComponentArrayarray () noexcept
 direct access to array More...
 
constexpr ComponentArray::iterator begin () noexcept
 
constexpr ComponentArray::const_iterator begin () const noexcept
 
constexpr ComponentArray::iterator end () noexcept
 
constexpr ComponentArray::const_iterator end () const noexcept
 

Static Public Member Functions

static RGBAColor fromVec4 (const type::fixed_array< float, 4 > &color)
 
static RGBAColor fromVec4 (const type::fixed_array< double, 4 > &color)
 
static RGBAColor fromVec4 (const Vec4f &color)
 
static RGBAColor fromVec4 (const Vec4d &color)
 
static RGBAColor fromString (const std::string &str)
 
static RGBAColor fromFloat (float r, float g, float b, float a)
 
static RGBAColor fromStdArray (const std::array< float, 4 > &color)
 
static RGBAColor fromStdArray (const std::array< double, 4 > &color)
 
static RGBAColor fromHSVA (float h, float s, float v, float a)
 
static bool read (const std::string &str, RGBAColor &color)
 
constexpr static const RGBAColorwhite ()
 
constexpr static const RGBAColorblack ()
 
constexpr static const RGBAColorred ()
 
constexpr static const RGBAColorgreen ()
 
constexpr static const RGBAColorblue ()
 
constexpr static const RGBAColorcyan ()
 
constexpr static const RGBAColormagenta ()
 
constexpr static const RGBAColoryellow ()
 
constexpr static const RGBAColorgray ()
 
constexpr static const RGBAColordarkgray ()
 
constexpr static const RGBAColorlightgray ()
 
static RGBAColor lighten (const RGBAColor &in, const SReal factor)
 enlight a color by a given factor. More...
 
static constexpr RGBAColor clamp (const RGBAColor &color, float min, float max)
 
static constexpr sofa::Size size ()
 

Friends

SOFA_TYPE_API std::ostream & operator<< (std::ostream &i, const RGBAColor &t)
 Write to an output stream. More...
 
SOFA_TYPE_API std::istream & operator>> (std::istream &i, RGBAColor &t)
 

Attribute details

◆ NumberOfComponents

constexpr sofa::Size sofa::type::RGBAColor::NumberOfComponents = 4
staticconstexpr

◆ static_size

constexpr sofa::Size sofa::type::RGBAColor::static_size = NumberOfComponents
staticconstexpr

Constructor details

◆ RGBAColor() [1/5]

constexpr sofa::type::RGBAColor::RGBAColor ( )
inlineconstexpr

◆ RGBAColor() [2/5]

constexpr sofa::type::RGBAColor::RGBAColor ( const std::array< float, NumberOfComponents > &  c)
inlineexplicitconstexpr

◆ RGBAColor() [3/5]

constexpr sofa::type::RGBAColor::RGBAColor ( float  r,
float  g,
float  b,
float  a 
)
inlineconstexpr

◆ RGBAColor() [4/5]

sofa::type::RGBAColor::RGBAColor ( const type::fixed_array< float, NumberOfComponents > &  c)

◆ RGBAColor() [5/5]

sofa::type::RGBAColor::RGBAColor ( const type::Vec4f c)

Function details

◆ a() [1/3]

constexpr float& sofa::type::RGBAColor::a ( )
inlineconstexpr

◆ a() [2/3]

constexpr const float& sofa::type::RGBAColor::a ( ) const
inlineconstexpr

◆ a() [3/3]

constexpr void sofa::type::RGBAColor::a ( const float  a)
inlineconstexpr

◆ array() [1/2]

constexpr const ComponentArray& sofa::type::RGBAColor::array ( ) const
inlineconstexprnoexcept

direct access to array

◆ array() [2/2]

constexpr ComponentArray& sofa::type::RGBAColor::array ( )
inlineconstexprnoexcept

direct access to array

◆ b() [1/3]

constexpr float& sofa::type::RGBAColor::b ( )
inlineconstexpr

◆ b() [2/3]

constexpr const float& sofa::type::RGBAColor::b ( ) const
inlineconstexpr

◆ b() [3/3]

constexpr void sofa::type::RGBAColor::b ( const float  b)
inlineconstexpr

◆ begin() [1/2]

constexpr ComponentArray::const_iterator sofa::type::RGBAColor::begin ( ) const
inlineconstexprnoexcept

◆ begin() [2/2]

constexpr ComponentArray::iterator sofa::type::RGBAColor::begin ( )
inlineconstexprnoexcept

◆ black()

constexpr const RGBAColor & sofa::type::RGBAColor::black ( )
staticconstexpr

◆ blue()

constexpr const RGBAColor & sofa::type::RGBAColor::blue ( )
staticconstexpr

◆ clamp()

static constexpr RGBAColor sofa::type::RGBAColor::clamp ( const RGBAColor color,
float  min,
float  max 
)
inlinestaticconstexpr

◆ cyan()

constexpr const RGBAColor & sofa::type::RGBAColor::cyan ( )
staticconstexpr

◆ darkgray()

constexpr const RGBAColor & sofa::type::RGBAColor::darkgray ( )
staticconstexpr

◆ data()

constexpr const float* sofa::type::RGBAColor::data ( ) const
inlineconstexprnoexcept

◆ end() [1/2]

constexpr ComponentArray::const_iterator sofa::type::RGBAColor::end ( ) const
inlineconstexprnoexcept

◆ end() [2/2]

constexpr ComponentArray::iterator sofa::type::RGBAColor::end ( )
inlineconstexprnoexcept

◆ fromFloat()

RGBAColor sofa::type::RGBAColor::fromFloat ( float  r,
float  g,
float  b,
float  a 
)
static

◆ fromHSVA()

RGBAColor sofa::type::RGBAColor::fromHSVA ( float  h,
float  s,
float  v,
float  a 
)
static

◆ fromStdArray() [1/2]

RGBAColor sofa::type::RGBAColor::fromStdArray ( const std::array< double, 4 > &  color)
static

◆ fromStdArray() [2/2]

RGBAColor sofa::type::RGBAColor::fromStdArray ( const std::array< float, 4 > &  color)
static

◆ fromString()

RGBAColor sofa::type::RGBAColor::fromString ( const std::string &  str)
static

◆ fromVec4() [1/4]

RGBAColor sofa::type::RGBAColor::fromVec4 ( const type::fixed_array< double, 4 > &  color)
static

◆ fromVec4() [2/4]

RGBAColor sofa::type::RGBAColor::fromVec4 ( const type::fixed_array< float, 4 > &  color)
static

◆ fromVec4() [3/4]

RGBAColor sofa::type::RGBAColor::fromVec4 ( const Vec4d color)
static

◆ fromVec4() [4/4]

RGBAColor sofa::type::RGBAColor::fromVec4 ( const Vec4f color)
static

◆ g() [1/3]

constexpr float& sofa::type::RGBAColor::g ( )
inlineconstexpr

◆ g() [2/3]

constexpr const float& sofa::type::RGBAColor::g ( ) const
inlineconstexpr

◆ g() [3/3]

constexpr void sofa::type::RGBAColor::g ( const float  g)
inlineconstexpr

◆ gray()

constexpr const RGBAColor & sofa::type::RGBAColor::gray ( )
staticconstexpr

◆ green()

constexpr const RGBAColor & sofa::type::RGBAColor::green ( )
staticconstexpr

◆ lighten()

RGBAColor sofa::type::RGBAColor::lighten ( const RGBAColor in,
const SReal  factor 
)
static

enlight a color by a given factor.

◆ lightgray()

constexpr const RGBAColor & sofa::type::RGBAColor::lightgray ( )
staticconstexpr

◆ magenta()

constexpr const RGBAColor & sofa::type::RGBAColor::magenta ( )
staticconstexpr

◆ operator!=()

bool sofa::type::RGBAColor::operator!= ( const RGBAColor b) const
inline

◆ operator*()

RGBAColor sofa::type::RGBAColor::operator* ( float  f) const

◆ operator<()

bool sofa::type::RGBAColor::operator< ( const RGBAColor b) const
inline

◆ operator==()

bool sofa::type::RGBAColor::operator== ( const RGBAColor b) const
inline

◆ operator[]() [1/2]

constexpr float& sofa::type::RGBAColor::operator[] ( std::size_t  i)
inlineconstexpr

◆ operator[]() [2/2]

constexpr const float& sofa::type::RGBAColor::operator[] ( std::size_t  i) const
inlineconstexpr

◆ r() [1/3]

constexpr float& sofa::type::RGBAColor::r ( )
inlineconstexpr

◆ r() [2/3]

constexpr const float& sofa::type::RGBAColor::r ( ) const
inlineconstexpr

◆ r() [3/3]

constexpr void sofa::type::RGBAColor::r ( const float  r)
inlineconstexpr

◆ read()

bool sofa::type::RGBAColor::read ( const std::string &  str,
RGBAColor color 
)
static

◆ red()

constexpr const RGBAColor & sofa::type::RGBAColor::red ( )
staticconstexpr

◆ set()

void sofa::type::RGBAColor::set ( float  r,
float  g,
float  b,
float  a 
)

◆ size()

static constexpr sofa::Size sofa::type::RGBAColor::size ( void  )
inlinestaticconstexpr

◆ white()

constexpr const RGBAColor & sofa::type::RGBAColor::white ( )
staticconstexpr

◆ yellow()

constexpr const RGBAColor & sofa::type::RGBAColor::yellow ( )
staticconstexpr

Related details

◆ operator<<

SOFA_TYPE_API std::ostream& operator<< ( std::ostream &  i,
const RGBAColor t 
)
friend

Write to an output stream.

◆ operator>>

SOFA_TYPE_API std::istream& operator>> ( std::istream &  i,
RGBAColor t 
)
friend