Rendering Engine 0.2.9
Modular Graphics Rendering Engine | v0.2.9
rendering_engine::Color Struct Reference

Represents a color with red, green, blue, and alpha channels. More...

#include <image_data.hpp>

Public Member Functions

 Color ()
 Default constructor. Initializes to black with full opacity. More...
 
 Color (uint8_t iR, uint8_t iG, uint8_t iB)
 Constructs a fully opaque RGB color. More...
 
 Color (uint8_t iR, uint8_t iG, uint8_t iB, uint8_t iA)
 Constructs a color with specified RGBA channels. More...
 
bool operator== (Color const &rhs) const
 Equality operator for comparing two colors. More...
 

Public Attributes

uint8_t r = 0
 
uint8_t g = 0
 
uint8_t b = 0
 
uint8_t a = 255
 

Detailed Description

Represents a color with red, green, blue, and alpha channels.

Definition at line 22 of file image_data.hpp.

Constructor & Destructor Documentation

◆ Color() [1/3]

rendering_engine::Color::Color ( )
inline

Default constructor. Initializes to black with full opacity.

Definition at line 27 of file image_data.hpp.

28 :
29 Color( uint8_t{0U}, uint8_t{0U}, uint8_t{0U}, uint8_t{255U} )
30 {}
Color()
Default constructor. Initializes to black with full opacity.
Definition: image_data.hpp:27

◆ Color() [2/3]

rendering_engine::Color::Color ( uint8_t  iR,
uint8_t  iG,
uint8_t  iB 
)
inline

Constructs a fully opaque RGB color.

Parameters
iRRed channel [0�255]
iGGreen channel [0�255]
iBBlue channel [0�255]

Definition at line 37 of file image_data.hpp.

38 :
39 Color( iR, iG, iB, uint8_t{255U} )
40 {}

◆ Color() [3/3]

rendering_engine::Color::Color ( uint8_t  iR,
uint8_t  iG,
uint8_t  iB,
uint8_t  iA 
)
inline

Constructs a color with specified RGBA channels.

Parameters
iRRed channel [0�255]
iGGreen channel [0�255]
iBBlue channel [0�255]
iAAlpha channel [0�255]

Definition at line 48 of file image_data.hpp.

49 :
50 r(std::clamp(iR, uint8_t{0U}, uint8_t{255U})),
51 g(std::clamp(iG, uint8_t{0U}, uint8_t{255U})),
52 b(std::clamp(iB, uint8_t{0U}, uint8_t{255U})),
53 a(std::clamp(iA, uint8_t{0U}, uint8_t{255U}))
54 {}

Member Function Documentation

◆ operator==()

bool rendering_engine::Color::operator== ( Color const &  rhs) const
inline

Equality operator for comparing two colors.

Definition at line 59 of file image_data.hpp.

60 {
61 return (this->r == rhs.r) && (this->g == rhs.g) && (this->b == rhs.b) && (this->a == rhs.a);
62 }

Member Data Documentation

◆ a

uint8_t rendering_engine::Color::a = 255

Definition at line 67 of file image_data.hpp.

◆ b

uint8_t rendering_engine::Color::b = 0

Definition at line 66 of file image_data.hpp.

◆ g

uint8_t rendering_engine::Color::g = 0

Definition at line 65 of file image_data.hpp.

◆ r

uint8_t rendering_engine::Color::r = 0

Definition at line 64 of file image_data.hpp.


The documentation for this struct was generated from the following file: