-
Notifications
You must be signed in to change notification settings - Fork 0
/
Color.h
49 lines (38 loc) · 832 Bytes
/
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
#ifndef RR_COLOR
#define RR_COLOR
static u32 ColorspaceToggle(u32 color)
{
u32 a = (color >> 24 & 0xFF);
u32 rOrb = (color >> 16) & 0xFF;
u32 g = (color >> 8) & 0xFF;
u32 bOrr = (color >> 0) & 0xFF;
u32 ret = (a << 24) | (bOrr << 16) | (g << 8) | (rOrb << 0);
return ret;
}
static u32 RGBAfromHEX(u32 pack)
{
u32 a = 0xFF;
u32 r = (pack >> 16) & 0xFF;
u32 g = (pack >> 8) & 0xFF;
u32 b = (pack >> 0) & 0xFF;
u32 ret = (a << 24) | (b << 16) | (g << 8) | (r << 0);
return ret;
}
static v4 ColorspaceToggle(v4 color)
{
v4 ret;
ret.a = color.a;
ret.r = color.b;
ret.b = color.r;
ret.g = color.g;
return ret;
}
static v3 ColorspaceToggle(v3 color)
{
v3 ret;
ret.r = color.b;
ret.b = color.r;
ret.g = color.g;
return ret;
}
#endif // !RR_COLOR