mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-09-23 23:00:42 +00:00
32-bit color support
This commit is contained in:
@@ -10,7 +10,9 @@ namespace PortabilityLayer
|
||||
|
||||
bool operator==(const RGBAColor &other) const;
|
||||
bool operator!=(const RGBAColor &other) const;
|
||||
static RGBAColor Create(uint8_t r, uint8_t g, uint8_t b, uint8_t a);
|
||||
static RGBAColor Create(uint8_t r, uint8_t g, uint8_t b, uint8_t a);
|
||||
|
||||
uint32_t AsUInt32() const;
|
||||
};
|
||||
|
||||
inline RGBAColor RGBAColor::Create(uint8_t r, uint8_t g, uint8_t b, uint8_t a)
|
||||
@@ -32,5 +34,16 @@ namespace PortabilityLayer
|
||||
inline bool RGBAColor::operator!=(const RGBAColor &other) const
|
||||
{
|
||||
return !((*this) == other);
|
||||
}
|
||||
}
|
||||
|
||||
inline uint32_t RGBAColor::AsUInt32() const
|
||||
{
|
||||
uint32_t rgbaColor = 0;
|
||||
uint8_t *rgbaColorBytes = reinterpret_cast<uint8_t*>(&rgbaColor);
|
||||
rgbaColorBytes[0] = r;
|
||||
rgbaColorBytes[1] = g;
|
||||
rgbaColorBytes[2] = b;
|
||||
rgbaColorBytes[3] = a;
|
||||
return rgbaColor;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user