This commit is contained in:
elasota
2021-04-25 22:07:04 -04:00
parent 9341c4c378
commit 19b1a307e7

View File

@@ -1,39 +1,39 @@
#pragma once #pragma once
#include <stdint.h> #include <stdint.h>
namespace PortabilityLayer namespace PortabilityLayer
{ {
struct RGBAColor struct RGBAColor
{ {
uint8_t r, g, b, a; uint8_t r, g, b, a;
bool operator==(const RGBAColor &other) const; bool operator==(const RGBAColor &other) const;
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; uint32_t AsUInt32() const;
}; };
inline RGBAColor RGBAColor::Create(uint8_t r, uint8_t g, uint8_t b, uint8_t a) inline RGBAColor RGBAColor::Create(uint8_t r, uint8_t g, uint8_t b, uint8_t a)
{ {
RGBAColor color; RGBAColor color;
color.r = r; color.r = r;
color.g = g; color.g = g;
color.b = b; color.b = b;
color.a = a; color.a = a;
return color; return color;
} }
inline bool RGBAColor::operator==(const RGBAColor &other) const inline bool RGBAColor::operator==(const RGBAColor &other) const
{ {
return this->r == other.r && this->g == other.g && this->b == other.b && this->a == other.a; return this->r == other.r && this->g == other.g && this->b == other.b && this->a == other.a;
} }
inline bool RGBAColor::operator!=(const RGBAColor &other) const inline bool RGBAColor::operator!=(const RGBAColor &other) const
{ {
return !((*this) == other); return !((*this) == other);
} }
inline uint32_t RGBAColor::AsUInt32() const inline uint32_t RGBAColor::AsUInt32() const
@@ -46,4 +46,4 @@ namespace PortabilityLayer
rgbaColorBytes[3] = a; rgbaColorBytes[3] = a;
return rgbaColor; return rgbaColor;
} }
} }