fe7e00fd2c53c552e63fff48684c645c4a73681e
[rocksndiamonds.git] / src / game_bd / bd_colors.h
1 /*
2  * Copyright (c) 2007, 2008, 2009, Czirkos Zoltan <cirix@fw.hu>
3  *
4  * Permission to use, copy, modify, and distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16
17 #ifndef BD_COLORS_H
18 #define BD_COLORS_H
19
20
21 typedef unsigned int GdColor;
22
23 /* color internal:
24    XXRRGGBB;
25    XX is 0 for RGB,
26          1 for c64 colors (bb=index)
27          3 for c64dtv (bb=index)
28          2 for atari colors (bb=index)
29 */
30
31 typedef enum _color_type
32 {
33   GD_COLOR_TYPE_RGB     = 0,
34   GD_COLOR_TYPE_C64     = 1,
35   GD_COLOR_TYPE_C64DTV  = 2,
36   GD_COLOR_TYPE_ATARI   = 3,
37
38   GD_COLOR_TYPE_UNKNOWN    /* should be the last one */
39 } GdColorType;
40
41 /* traditional c64 color indexes. */
42 #define GD_COLOR_INDEX_BLACK            (0)
43 #define GD_COLOR_INDEX_WHITE            (1)
44 #define GD_COLOR_INDEX_RED              (2)
45 #define GD_COLOR_INDEX_PURPLE           (4)
46 #define GD_COLOR_INDEX_CYAN             (3)
47 #define GD_COLOR_INDEX_GREEN            (5)
48 #define GD_COLOR_INDEX_BLUE             (6)
49 #define GD_COLOR_INDEX_YELLOW           (7)
50 #define GD_COLOR_INDEX_ORANGE           (8)
51 #define GD_COLOR_INDEX_BROWN            (9)
52 #define GD_COLOR_INDEX_LIGHTRED         (10)
53 #define GD_COLOR_INDEX_GRAY1            (11)
54 #define GD_COLOR_INDEX_GRAY2            (12)
55 #define GD_COLOR_INDEX_LIGHTGREEN       (13)
56 #define GD_COLOR_INDEX_LIGHTBLUE        (14)
57 #define GD_COLOR_INDEX_GRAY3            (15)
58
59 #define GD_GDASH_BLACK                  (gd_gdash_color(GD_COLOR_INDEX_BLACK))
60 #define GD_GDASH_WHITE                  (gd_gdash_color(GD_COLOR_INDEX_WHITE))
61 #define GD_GDASH_RED                    (gd_gdash_color(GD_COLOR_INDEX_RED))
62 #define GD_GDASH_PURPLE                 (gd_gdash_color(GD_COLOR_INDEX_PURPLE))
63 #define GD_GDASH_CYAN                   (gd_gdash_color(GD_COLOR_INDEX_CYAN))
64 #define GD_GDASH_GREEN                  (gd_gdash_color(GD_COLOR_INDEX_GREEN))
65 #define GD_GDASH_BLUE                   (gd_gdash_color(GD_COLOR_INDEX_BLUE))
66 #define GD_GDASH_YELLOW                 (gd_gdash_color(GD_COLOR_INDEX_YELLOW))
67 #define GD_GDASH_ORANGE                 (gd_gdash_color(GD_COLOR_INDEX_ORANGE))
68 #define GD_GDASH_BROWN                  (gd_gdash_color(GD_COLOR_INDEX_BROWN))
69 #define GD_GDASH_LIGHTRED               (gd_gdash_color(GD_COLOR_INDEX_LIGHTRED))
70 #define GD_GDASH_GRAY1                  (gd_gdash_color(GD_COLOR_INDEX_GRAY1))
71 #define GD_GDASH_GRAY2                  (gd_gdash_color(GD_COLOR_INDEX_GRAY2))
72 #define GD_GDASH_LIGHTGREEN             (gd_gdash_color(GD_COLOR_INDEX_LIGHTGREEN))
73 #define GD_GDASH_LIGHTBLUE              (gd_gdash_color(GD_COLOR_INDEX_LIGHTBLUE))
74 #define GD_GDASH_GRAY3                  (gd_gdash_color(GD_COLOR_INDEX_GRAY3))
75
76 #define GD_GDASH_MIDDLEBLUE             (gd_gdash_color(16))
77
78 #define GD_COLOR_INVALID                (0xFFFFFFFF)
79
80
81 /* color */
82 GdColor gd_c64_color(int index);
83 GdColor gd_atari_color(int index);
84 GdColor gd_c64dtv_color(int index);
85 GdColor gd_color_get_from_rgb(int r, int g, int b);
86 GdColor gd_color_get_from_string(const char *color);
87 const char *gd_color_get_string(GdColor color);
88
89 boolean gd_color_is_c64(GdColor color);
90 boolean gd_color_is_atari(GdColor color);
91 boolean gd_color_is_dtv(GdColor color);
92 boolean gd_color_is_unknown(GdColor color);
93
94 GdColor gd_gdash_color(int c);
95
96 #endif  // BD_COLORS_H