Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
Color Class Reference

Class that holds an RGBA color with 8-bits per component. More...

#include <Color.h>

Public Member Functions

 Color ()=default
 Constructors.
 
 Color (const Color &inRHS)=default
 
Coloroperator= (const Color &inRHS)=default
 
constexpr Color (uint32 inColor)
 
constexpr Color (uint8 inRed, uint8 inGreen, uint8 inBlue, uint8 inAlpha=255)
 
constexpr Color (ColorArg inRHS, uint8 inAlpha)
 
bool operator== (ColorArg inRHS) const
 Comparison.
 
bool operator!= (ColorArg inRHS) const
 
uint32 GetUInt32 () const
 Convert to uint32.
 
uint8 operator() (uint inIdx) const
 Element access, 0 = red, 1 = green, 2 = blue, 3 = alpha.
 
uint8operator() (uint inIdx)
 
Color operator* (const Color &inRHS) const
 Multiply two colors.
 
Color operator* (float inIntensity) const
 Multiply color with intensity in the range [0, 1].
 
Vec4 ToVec4 () const
 Convert to Vec4 with range [0, 1].
 
uint8 GetIntensity () const
 Get grayscale intensity of color.
 

Static Public Member Functions

static Color sGetDistinctColor (int inIndex)
 Get a visually distinct color.
 

Public Attributes

union { 
 
   uint32   mU32 
 Combined value for red, green, blue and alpha. More...
 
   struct { 
 
      uint8   r 
 Red channel. More...
 
      uint8   g 
 Green channel. More...
 
      uint8   b 
 Blue channel. More...
 
      uint8   a 
 Alpha channel. More...
 
   }  
 
};  
 

Static Public Attributes

static const Color sBlack
 Predefined colors.
 
static const Color sDarkRed
 
static const Color sRed
 
static const Color sDarkGreen
 
static const Color sGreen
 
static const Color sDarkBlue
 
static const Color sBlue
 
static const Color sYellow
 
static const Color sPurple
 
static const Color sCyan
 
static const Color sOrange
 
static const Color sDarkOrange
 
static const Color sGrey
 
static const Color sLightGrey
 
static const Color sWhite
 

Detailed Description

Class that holds an RGBA color with 8-bits per component.

Constructor & Destructor Documentation

◆ Color() [1/5]

Color::Color ( )
default

Constructors.

Intentionally not initialized for performance reasons

◆ Color() [2/5]

Color::Color ( const Color inRHS)
default

◆ Color() [3/5]

constexpr Color::Color ( uint32  inColor)
inlineexplicitconstexpr

◆ Color() [4/5]

constexpr Color::Color ( uint8  inRed,
uint8  inGreen,
uint8  inBlue,
uint8  inAlpha = 255 
)
inlineconstexpr

◆ Color() [5/5]

constexpr Color::Color ( ColorArg  inRHS,
uint8  inAlpha 
)
inlineconstexpr

Member Function Documentation

◆ GetIntensity()

uint8 Color::GetIntensity ( ) const
inline

Get grayscale intensity of color.

◆ GetUInt32()

uint32 Color::GetUInt32 ( ) const
inline

Convert to uint32.

◆ operator!=()

bool Color::operator!= ( ColorArg  inRHS) const
inline

◆ operator()() [1/2]

uint8 & Color::operator() ( uint  inIdx)
inline

◆ operator()() [2/2]

uint8 Color::operator() ( uint  inIdx) const
inline

Element access, 0 = red, 1 = green, 2 = blue, 3 = alpha.

◆ operator*() [1/2]

Color Color::operator* ( const Color inRHS) const
inline

Multiply two colors.

◆ operator*() [2/2]

Color Color::operator* ( float  inIntensity) const
inline

Multiply color with intensity in the range [0, 1].

◆ operator=()

Color & Color::operator= ( const Color inRHS)
default

◆ operator==()

bool Color::operator== ( ColorArg  inRHS) const
inline

Comparison.

◆ sGetDistinctColor()

Color Color::sGetDistinctColor ( int  inIndex)
static

Get a visually distinct color.

◆ ToVec4()

Vec4 Color::ToVec4 ( ) const
inline

Convert to Vec4 with range [0, 1].

Member Data Documentation

◆ [union]

union { ... } Color

◆ a

uint8 Color::a

Alpha channel.

◆ b

uint8 Color::b

Blue channel.

◆ g

uint8 Color::g

Green channel.

◆ mU32

uint32 Color::mU32

Combined value for red, green, blue and alpha.

◆ r

uint8 Color::r

Red channel.

◆ sBlack

JPH_NAMESPACE_BEGIN const Color Color::sBlack
static

Predefined colors.

◆ sBlue

const Color Color::sBlue
static

◆ sCyan

const Color Color::sCyan
static

◆ sDarkBlue

const Color Color::sDarkBlue
static

◆ sDarkGreen

const Color Color::sDarkGreen
static

◆ sDarkOrange

const Color Color::sDarkOrange
static

◆ sDarkRed

const Color Color::sDarkRed
static

◆ sGreen

const Color Color::sGreen
static

◆ sGrey

const Color Color::sGrey
static

◆ sLightGrey

const Color Color::sLightGrey
static

◆ sOrange

const Color Color::sOrange
static

◆ sPurple

const Color Color::sPurple
static

◆ sRed

const Color Color::sRed
static

◆ sWhite

const Color Color::sWhite
static

◆ sYellow

const Color Color::sYellow
static

The documentation for this class was generated from the following files: