Files

49 lines
1010 B
C++
Raw Permalink Normal View History

#ifndef _CTEXTCOLOR
#define _CTEXTCOLOR
2022-09-29 21:24:13 -07:00
#include <types.h>
2023-01-11 14:03:38 -08:00
#ifdef __MWERKS__
#pragma cpp_extensions on
#endif
2022-09-29 21:24:13 -07:00
class CTextColor {
public:
// TODO: Verify component ordering, there is evidence this might actually be ABGR instead of RGBA
CTextColor(uchar r, uchar g, uchar b, uchar a) : mR(r), mG(g), mB(b), mA(a) {}
2023-01-11 14:03:38 -08:00
CTextColor(const CTextColor& other) : mR(other.mR), mG(other.mG), mB(other.mB), mA(other.mA) {}
const CTextColor& operator=(const CTextColor& other) {
mR = other.mR;
mG = other.mG;
mB = other.mB;
mA = other.mA;
return *this;
}
uint GetRGBA() const { return mRgba; }
const uchar GetAlpha() const { return mA; }
const uchar GetBlue() const { return mB; }
const uchar GetGreen() const { return mG; }
const uchar GetRed() const { return mR; }
2023-01-11 14:03:38 -08:00
2022-09-29 21:24:13 -07:00
private:
2023-01-11 14:03:38 -08:00
union {
struct {
uchar mR;
uchar mG;
uchar mB;
uchar mA;
};
uint mRgba;
};
2022-09-29 21:24:13 -07:00
};
2023-01-11 14:03:38 -08:00
#ifdef __MWERKS__
#pragma cpp_extensions reset
2023-01-11 14:03:38 -08:00
#endif
#endif // _CTEXTCOLOR