-
Notifications
You must be signed in to change notification settings - Fork 0
/
jslib.hh
30 lines (24 loc) · 870 Bytes
/
jslib.hh
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
#ifndef JSLIB_FILE_H
#define JSLIB_FILE_H
class js_color {
unsigned char a,b,g,r;
public:
constexpr js_color(unsigned char _a, unsigned char _b, unsigned char _g, unsigned char _r) : a(_a), b(_b), g(_g), r(_r) {
}
constexpr js_color operator* ( js_color color ) const {
return js_color( (a * color.a) >> 8,
(b * color.b) >> 8,
(g * color.g) >> 8,
(r * color.r) >> 8 );
}
constexpr operator unsigned int() const {
return (a << 24) | (b << 16) | (g << 8) | r;
}
};
const js_color js_red(0xFF, 0x00, 0x00, 0xFF);
const js_color js_yellow(0xFF, 0x00, 0xFF, 0xFF);
const js_color js_green(0xFF, 0x00, 0xFF, 0x00);
const js_color js_blue(0xFF, 0xFF, 0x00, 0x00);
const js_color js_black(0xFF, 0x00, 0x00, 0x00);
const js_color js_white(0xFF, 0xFF, 0xff, 0xFF);
#endif