Simox  2.3.74.0
simox::color::Color Struct Reference

An RGBA color, where each component is a byte in [0, 255]. More...

Inheritance diagram for simox::color::Color:
simox::color::KellyColor

Public Member Functions

 Color ()=default
 Construct a black color. More...
 
 Color (uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)
 Construct a color from RGBA. More...
 
template<typename Int , std::enable_if_t< std::is_integral_v< Int >, int > = 0>
 Color (Int r, Int g, Int b, Int a=255)
 Construct a color from integer RGBA. More...
 
template<typename Float , std::enable_if_t< std::is_floating_point_v< Float >, int > = 0>
 Color (Float r, Float g, Float b, Float a=1.0)
 Construct a color from float RGBA. More...
 
template<typename T >
 Color (Eigen::Matrix< T, 3, 1 > vector3)
 Construct a color from an RGB vector. More...
 
template<typename T >
 Color (Eigen::Matrix< T, 4, 1 > vector4)
 Construct a color from an RGBA vector. More...
 
Eigen::Vector3i to_vector3i () const
 
Eigen::Vector4i to_vector4i () const
 
Eigen::Vector3f to_vector3f () const
 
Eigen::Vector4f to_vector4f () const
 
template<typename IntOrFloat >
Color with_alpha (IntOrFloat a) const
 Return a copy of this with the given alpha. More...
 

Static Public Member Functions

static Color black (int a=255)
 
static Color white (int a=255)
 
static Color gray (int g=128, int a=255)
 
static Color red (int r=255, int a=255)
 
static Color green (int g=255, int a=255)
 
static Color blue (int b=255, int a=255)
 
static Color cyan (int c=255, int a=255)
 Green + Blue. More...
 
static Color yellow (int y=255, int a=255)
 Red + Green. More...
 
static Color magenta (int m=255, int a=255)
 Red + Blue. More...
 
static Color orange (int o=255, int a=255)
 2 Red + 1 Green More...
 
static Color pink (int p=255, int a=255)
 2 Red + 1 Blue More...
 
static Color lime (int l=255, int a=255)
 2 Green + 1 Red More...
 
static Color turquoise (int t=255, int a=255)
 2 Green + 1 Blue More...
 
static Color azure (int az=255, int a=255)
 2 Blue + 1 Green More...
 
static Color purple (int p=255, int a=255)
 2 Blue + 1 Red More...
 
static Color kit_green (int a=255)
 
static Color kit_blue (int a=255)
 
static Color kit_maygreen (int a=255)
 
static Color kit_yellow (int a=255)
 
static Color kit_orange (int a=255)
 
static Color kit_brown (int a=255)
 
static Color kit_red (int a=255)
 
static Color kit_purple (int a=255)
 
static Color kit_cyan (int a=255)
 

Data Fields

uint8_t r = 0
 Red in [0, 255]. More...
 
uint8_t g = 0
 Green in [0, 255]. More...
 
uint8_t b = 0
 Blue in [0, 255]. More...
 
uint8_t a = 255
 Alpha in [0, 255], i.e. opacity (0: transparent, 255: visible). More...
 

Detailed Description

An RGBA color, where each component is a byte in [0, 255].

Constructor & Destructor Documentation

◆ Color() [1/6]

simox::color::Color::Color ( )
default

Construct a black color.

◆ Color() [2/6]

simox::color::Color::Color ( uint8_t  r,
uint8_t  g,
uint8_t  b,
uint8_t  a = 255 
)

Construct a color from RGBA.

◆ Color() [3/6]

template<typename Int , std::enable_if_t< std::is_integral_v< Int >, int > = 0>
simox::color::Color::Color ( Int  r,
Int  g,
Int  b,
Int  a = 255 
)
inline

Construct a color from integer RGBA.

◆ Color() [4/6]

template<typename Float , std::enable_if_t< std::is_floating_point_v< Float >, int > = 0>
simox::color::Color::Color ( Float  r,
Float  g,
Float  b,
Float  a = 1.0 
)
inline

Construct a color from float RGBA.

◆ Color() [5/6]

template<typename T >
simox::color::Color::Color ( Eigen::Matrix< T, 3, 1 >  vector3)
inline

Construct a color from an RGB vector.

◆ Color() [6/6]

template<typename T >
simox::color::Color::Color ( Eigen::Matrix< T, 4, 1 >  vector4)
inline

Construct a color from an RGBA vector.

Member Function Documentation

◆ azure()

static Color simox::color::Color::azure ( int  az = 255,
int  a = 255 
)
inlinestatic

2 Blue + 1 Green

◆ black()

static Color simox::color::Color::black ( int  a = 255)
inlinestatic

◆ blue()

static Color simox::color::Color::blue ( int  b = 255,
int  a = 255 
)
inlinestatic

◆ cyan()

static Color simox::color::Color::cyan ( int  c = 255,
int  a = 255 
)
inlinestatic

Green + Blue.

◆ gray()

static Color simox::color::Color::gray ( int  g = 128,
int  a = 255 
)
inlinestatic

◆ green()

static Color simox::color::Color::green ( int  g = 255,
int  a = 255 
)
inlinestatic

◆ kit_blue()

static Color simox::color::Color::kit_blue ( int  a = 255)
inlinestatic

◆ kit_brown()

static Color simox::color::Color::kit_brown ( int  a = 255)
inlinestatic

◆ kit_cyan()

static Color simox::color::Color::kit_cyan ( int  a = 255)
inlinestatic

◆ kit_green()

static Color simox::color::Color::kit_green ( int  a = 255)
inlinestatic

◆ kit_maygreen()

static Color simox::color::Color::kit_maygreen ( int  a = 255)
inlinestatic

◆ kit_orange()

static Color simox::color::Color::kit_orange ( int  a = 255)
inlinestatic

◆ kit_purple()

static Color simox::color::Color::kit_purple ( int  a = 255)
inlinestatic

◆ kit_red()

static Color simox::color::Color::kit_red ( int  a = 255)
inlinestatic

◆ kit_yellow()

static Color simox::color::Color::kit_yellow ( int  a = 255)
inlinestatic

◆ lime()

static Color simox::color::Color::lime ( int  l = 255,
int  a = 255 
)
inlinestatic

2 Green + 1 Red

◆ magenta()

static Color simox::color::Color::magenta ( int  m = 255,
int  a = 255 
)
inlinestatic

Red + Blue.

◆ orange()

static Color simox::color::Color::orange ( int  o = 255,
int  a = 255 
)
inlinestatic

2 Red + 1 Green

◆ pink()

static Color simox::color::Color::pink ( int  p = 255,
int  a = 255 
)
inlinestatic

2 Red + 1 Blue

◆ purple()

static Color simox::color::Color::purple ( int  p = 255,
int  a = 255 
)
inlinestatic

2 Blue + 1 Red

◆ red()

static Color simox::color::Color::red ( int  r = 255,
int  a = 255 
)
inlinestatic

◆ to_vector3f()

Eigen::Vector3f simox::color::Color::to_vector3f ( ) const

◆ to_vector3i()

Eigen::Vector3i simox::color::Color::to_vector3i ( ) const

◆ to_vector4f()

Eigen::Vector4f simox::color::Color::to_vector4f ( ) const

◆ to_vector4i()

Eigen::Vector4i simox::color::Color::to_vector4i ( ) const

◆ turquoise()

static Color simox::color::Color::turquoise ( int  t = 255,
int  a = 255 
)
inlinestatic

2 Green + 1 Blue

◆ white()

static Color simox::color::Color::white ( int  a = 255)
inlinestatic

◆ with_alpha()

template<typename IntOrFloat >
Color simox::color::Color::with_alpha ( IntOrFloat  a) const
inline

Return a copy of this with the given alpha.

◆ yellow()

static Color simox::color::Color::yellow ( int  y = 255,
int  a = 255 
)
inlinestatic

Red + Green.

Field Documentation

◆ a

uint8_t simox::color::Color::a = 255

Alpha in [0, 255], i.e. opacity (0: transparent, 255: visible).

◆ b

uint8_t simox::color::Color::b = 0

Blue in [0, 255].

◆ g

uint8_t simox::color::Color::g = 0

Green in [0, 255].

◆ r

uint8_t simox::color::Color::r = 0

Red in [0, 255].