-
Notifications
You must be signed in to change notification settings - Fork 0
/
Color.h
120 lines (98 loc) · 2.89 KB
/
Color.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#ifndef __COLOR__
#define __COLOR__
#include <iostream>
#include "Defines.h"
class CColor {
// Enums
public:
enum EColor : u32 {
C_Black = 0x000000, // (FF)
C_White = 0xFFFFFF, // (FF)
C_Red = 0xFF0000, // (FF)
C_Green = 0x00FF00, // (FF)
C_Blue = 0x0000FF, // (FF)
C_Yellow = 0xFFFF00, // (FF)
C_Cyan = 0x00FFFF, // (FF)
C_Magenta = 0xFF00FF, // (FF)
C_Gray_12_5 = 0x202020, // (FF)
C_Gray_25 = 0x404040, // (FF)
C_Gray_37_5 = 0x606060, // (FF)
C_Gray = 0x808080, // (FF)
C_Gray_50 = C_Gray,
C_Gray_62_5 = 0xA0A0A0, // (FF)
C_Gray_75 = 0xC0C0C0, // (FF)
C_Gray_87_5 = 0xE0E0E0, // (FF)
C_Red_Dark = 0x800000, // (FF)
C_Red_Light = 0xFF8080, // (FF)
C_Green_Dark = 0x008000, // (FF)
C_Green_Light = 0x80FF80, // (FF)
C_Blue_Dark = 0x000080, // (FF)
C_Blue_Light = 0x8080FF, // (FF)
C_Yellow_Dark = 0x808000, // (FF)
C_Yellow_Light = 0xFFFF80, // (FF)
C_Cyan_Dark = 0x008080, // (FF)
C_Cyan_Light = 0x80FFFF, // (FF)
C_Magenta_Dark = 0x800080, // (FF)
C_Magenta_Light = 0xFF80FF, // (FF)
};
// Structs
public:
struct SColorPack {
// Functions
public:
SColorPack(u8 uRed, u8 uGreen, u8 uBlue, u8 uAlpha = '\x00');
SColorPack(f32 fRed, f32 fGreen, f32 fBlue, f32 fAlpha = 1.0f);
// Variables
public:
u8 m_uAlpha;
u8 m_uBlue;
u8 m_uGreen;
u8 m_uRed;
};
// Functions
public:
CColor(u32 uColor = EColor::C_Black, b8 bHasAlpha = false);
CColor(u8 uRed, u8 uGreen, u8 uBlue, u8 uAlpha = '\x00');
CColor(f32 fRed, f32 fGreen, f32 fBlue, f32 fAlpha = 1.0f);
b8 operator==(const CColor& rColor) const;
friend std::ostream& operator<<(std::ostream& rOStream, const CColor& rColor);
// Variables
public:
union {
u32 m_uColor;
u8 m_aValues[4];
SColorPack m_Pack;
};
// Constants
public:
static const CColor sm_kTransparent;
static const CColor sm_kBlack;
static const CColor sm_kWhite;
static const CColor sm_kRed;
static const CColor sm_kGreen;
static const CColor sm_kBlue;
static const CColor sm_kYellow;
static const CColor sm_kCyan;
static const CColor sm_kMagenta;
static const CColor sm_kGray_12_5;
static const CColor sm_kGray_25;
static const CColor sm_kGray_37_5;
static const CColor sm_kGray;
static const CColor sm_kGray_50;
static const CColor sm_kGray_62_5;
static const CColor sm_kGray_75;
static const CColor sm_kGray_87_5;
static const CColor sm_kRed_Dark;
static const CColor sm_kRed_Light;
static const CColor sm_kGreen_Dark;
static const CColor sm_kGreen_Light;
static const CColor sm_kBlue_Dark;
static const CColor sm_kBlue_Light;
static const CColor sm_kYellow_Dark;
static const CColor sm_kYellow_Light;
static const CColor sm_kCyan_Dark;
static const CColor sm_kCyan_Light;
static const CColor sm_kMagenta_Dark;
static const CColor sm_kMagenta_Light;
};
#endif // __COLOR__