-
-
Notifications
You must be signed in to change notification settings - Fork 112
/
color.h
79 lines (67 loc) · 2.26 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
/* Copyright (C) 2013-2014 Michal Brzozowski ([email protected])
This file is part of KeeperRL.
KeeperRL is free software; you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
KeeperRL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program.
If not, see http://www.gnu.org/licenses/ . */
#pragma once
#include "util.h"
namespace SDL {
struct SDL_Color;
};
struct Color {
Color(const SDL::SDL_Color&);
Color(unsigned char, unsigned char, unsigned char, unsigned char = 255);
Color transparency(int) const;
static Color f(double, double, double, double = 1.0);
Color operator*(Color);
Color blend(Color) const;
Color();
bool operator == (const Color&) const;
bool operator != (const Color&) const;
bool operator < (const Color&) const;
operator SDL::SDL_Color() const;
static Color WHITE;
static Color MAIN_MENU_ON;
static Color MAIN_MENU_OFF;
static Color YELLOW;
static Color LIGHT_BROWN;
static Color ORANGE_BROWN;
static Color BROWN;
static Color DARK_BROWN;
static Color LIGHT_GRAY;
static Color GRAY;
static Color ALMOST_GRAY;
static Color DARK_GRAY;
static Color ALMOST_BLACK;
static Color ALMOST_DARK_GRAY;
static Color BLACK;
static Color ALMOST_WHITE;
static Color GREEN;
static Color LIGHT_GREEN;
static Color DARK_GREEN;
static Color RED;
static Color LIGHT_RED;
static Color DARK_RED;
static Color PINK;
static Color ORANGE;
static Color BLUE;
static Color DARK_BLUE;
static Color LIGHT_BLUE;
static Color SKY_BLUE;
static Color PURPLE;
static Color VIOLET;
static Color TRANSPARENT;
unsigned char SERIAL(r); // HASH(r)
unsigned char SERIAL(g); // HASH(g)
unsigned char SERIAL(b); // HASH(b)
unsigned char SERIAL(a); // HASH(a)
HASH_ALL(r, g, b, a)
template <typename Archive>
void serialize(Archive&, unsigned int);
};
extern string toString(const Color&);