Rendering Engine 0.2.0
Modular Graphics Rendering Engine | v0.2.0
Loading...
Searching...
No Matches
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.
 Color (uint8_t iR, uint8_t iG, uint8_t iB)
 Constructs a fully opaque RGB color.
 Color (uint8_t iR, uint8_t iG, uint8_t iB, uint8_t iA)
 Constructs a color with specified RGBA channels.
bool operator== (Color const &rhs) const
 Equality operator for comparing two colors.

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 20 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 25 of file image_data.hpp.

26 :
27 Color( uint8_t{0U}, uint8_t{0U}, uint8_t{0U}, uint8_t{255U} )
28 {}
Color()
Default constructor. Initializes to black with full opacity.

◆ 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 35 of file image_data.hpp.

36 :
37 Color( iR, iG, iB, uint8_t{255U} )
38 {}

◆ 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 46 of file image_data.hpp.

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

Member Function Documentation

◆ operator==()

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

Equality operator for comparing two colors.

Definition at line 57 of file image_data.hpp.

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

Member Data Documentation

◆ a

uint8_t rendering_engine::Color::a = 255

Definition at line 65 of file image_data.hpp.

◆ b

uint8_t rendering_engine::Color::b = 0

Definition at line 64 of file image_data.hpp.

◆ g

uint8_t rendering_engine::Color::g = 0

Definition at line 63 of file image_data.hpp.

◆ r

uint8_t rendering_engine::Color::r = 0

Definition at line 62 of file image_data.hpp.


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