2 pygame - Python Game Library
3 Copyright (C) 2000-2001 Pete Shinners
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with this library; if not, write to the Free
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 /* SDL 2 does not assign a default palette color scheme to a new 8 bit
29 * surface. Instead, the palette is set all white. This defines the SDL 1.2
32 static const SDL_Color default_palette_colors[] = {
33 {0, 0, 0, 255}, {0, 0, 85, 255}, {0, 0, 170, 255},
34 {0, 0, 255, 255}, {0, 36, 0, 255}, {0, 36, 85, 255},
35 {0, 36, 170, 255}, {0, 36, 255, 255}, {0, 73, 0, 255},
36 {0, 73, 85, 255}, {0, 73, 170, 255}, {0, 73, 255, 255},
37 {0, 109, 0, 255}, {0, 109, 85, 255}, {0, 109, 170, 255},
38 {0, 109, 255, 255}, {0, 146, 0, 255}, {0, 146, 85, 255},
39 {0, 146, 170, 255}, {0, 146, 255, 255}, {0, 182, 0, 255},
40 {0, 182, 85, 255}, {0, 182, 170, 255}, {0, 182, 255, 255},
41 {0, 219, 0, 255}, {0, 219, 85, 255}, {0, 219, 170, 255},
42 {0, 219, 255, 255}, {0, 255, 0, 255}, {0, 255, 85, 255},
43 {0, 255, 170, 255}, {0, 255, 255, 255}, {85, 0, 0, 255},
44 {85, 0, 85, 255}, {85, 0, 170, 255}, {85, 0, 255, 255},
45 {85, 36, 0, 255}, {85, 36, 85, 255}, {85, 36, 170, 255},
46 {85, 36, 255, 255}, {85, 73, 0, 255}, {85, 73, 85, 255},
47 {85, 73, 170, 255}, {85, 73, 255, 255}, {85, 109, 0, 255},
48 {85, 109, 85, 255}, {85, 109, 170, 255}, {85, 109, 255, 255},
49 {85, 146, 0, 255}, {85, 146, 85, 255}, {85, 146, 170, 255},
50 {85, 146, 255, 255}, {85, 182, 0, 255}, {85, 182, 85, 255},
51 {85, 182, 170, 255}, {85, 182, 255, 255}, {85, 219, 0, 255},
52 {85, 219, 85, 255}, {85, 219, 170, 255}, {85, 219, 255, 255},
53 {85, 255, 0, 255}, {85, 255, 85, 255}, {85, 255, 170, 255},
54 {85, 255, 255, 255}, {170, 0, 0, 255}, {170, 0, 85, 255},
55 {170, 0, 170, 255}, {170, 0, 255, 255}, {170, 36, 0, 255},
56 {170, 36, 85, 255}, {170, 36, 170, 255}, {170, 36, 255, 255},
57 {170, 73, 0, 255}, {170, 73, 85, 255}, {170, 73, 170, 255},
58 {170, 73, 255, 255}, {170, 109, 0, 255}, {170, 109, 85, 255},
59 {170, 109, 170, 255}, {170, 109, 255, 255}, {170, 146, 0, 255},
60 {170, 146, 85, 255}, {170, 146, 170, 255}, {170, 146, 255, 255},
61 {170, 182, 0, 255}, {170, 182, 85, 255}, {170, 182, 170, 255},
62 {170, 182, 255, 255}, {170, 219, 0, 255}, {170, 219, 85, 255},
63 {170, 219, 170, 255}, {170, 219, 255, 255}, {170, 255, 0, 255},
64 {170, 255, 85, 255}, {170, 255, 170, 255}, {170, 255, 255, 255},
65 {255, 0, 0, 255}, {255, 0, 85, 255}, {255, 0, 170, 255},
66 {255, 0, 255, 255}, {255, 36, 0, 255}, {255, 36, 85, 255},
67 {255, 36, 170, 255}, {255, 36, 255, 255}, {255, 73, 0, 255},
68 {255, 73, 85, 255}, {255, 73, 170, 255}, {255, 73, 255, 255},
69 {255, 109, 0, 255}, {255, 109, 85, 255}, {255, 109, 170, 255},
70 {255, 109, 255, 255}, {255, 146, 0, 255}, {255, 146, 85, 255},
71 {255, 146, 170, 255}, {255, 146, 255, 255}, {255, 182, 0, 255},
72 {255, 182, 85, 255}, {255, 182, 170, 255}, {255, 182, 255, 255},
73 {255, 219, 0, 255}, {255, 219, 85, 255}, {255, 219, 170, 255},
74 {255, 219, 255, 255}, {255, 255, 0, 255}, {255, 255, 85, 255},
75 {255, 255, 170, 255}, {255, 255, 255, 255}, {0, 0, 0, 255},
76 {0, 0, 85, 255}, {0, 0, 170, 255}, {0, 0, 255, 255},
77 {0, 36, 0, 255}, {0, 36, 85, 255}, {0, 36, 170, 255},
78 {0, 36, 255, 255}, {0, 73, 0, 255}, {0, 73, 85, 255},
79 {0, 73, 170, 255}, {0, 73, 255, 255}, {0, 109, 0, 255},
80 {0, 109, 85, 255}, {0, 109, 170, 255}, {0, 109, 255, 255},
81 {0, 146, 0, 255}, {0, 146, 85, 255}, {0, 146, 170, 255},
82 {0, 146, 255, 255}, {0, 182, 0, 255}, {0, 182, 85, 255},
83 {0, 182, 170, 255}, {0, 182, 255, 255}, {0, 219, 0, 255},
84 {0, 219, 85, 255}, {0, 219, 170, 255}, {0, 219, 255, 255},
85 {0, 255, 0, 255}, {0, 255, 85, 255}, {0, 255, 170, 255},
86 {0, 255, 255, 255}, {85, 0, 0, 255}, {85, 0, 85, 255},
87 {85, 0, 170, 255}, {85, 0, 255, 255}, {85, 36, 0, 255},
88 {85, 36, 85, 255}, {85, 36, 170, 255}, {85, 36, 255, 255},
89 {85, 73, 0, 255}, {85, 73, 85, 255}, {85, 73, 170, 255},
90 {85, 73, 255, 255}, {85, 109, 0, 255}, {85, 109, 85, 255},
91 {85, 109, 170, 255}, {85, 109, 255, 255}, {85, 146, 0, 255},
92 {85, 146, 85, 255}, {85, 146, 170, 255}, {85, 146, 255, 255},
93 {85, 182, 0, 255}, {85, 182, 85, 255}, {85, 182, 170, 255},
94 {85, 182, 255, 255}, {85, 219, 0, 255}, {85, 219, 85, 255},
95 {85, 219, 170, 255}, {85, 219, 255, 255}, {85, 255, 0, 255},
96 {85, 255, 85, 255}, {85, 255, 170, 255}, {85, 255, 255, 255},
97 {170, 0, 0, 255}, {170, 0, 85, 255}, {170, 0, 170, 255},
98 {170, 0, 255, 255}, {170, 36, 0, 255}, {170, 36, 85, 255},
99 {170, 36, 170, 255}, {170, 36, 255, 255}, {170, 73, 0, 255},
100 {170, 73, 85, 255}, {170, 73, 170, 255}, {170, 73, 255, 255},
101 {170, 109, 0, 255}, {170, 109, 85, 255}, {170, 109, 170, 255},
102 {170, 109, 255, 255}, {170, 146, 0, 255}, {170, 146, 85, 255},
103 {170, 146, 170, 255}, {170, 146, 255, 255}, {170, 182, 0, 255},
104 {170, 182, 85, 255}, {170, 182, 170, 255}, {170, 182, 255, 255},
105 {170, 219, 0, 255}, {170, 219, 85, 255}, {170, 219, 170, 255},
106 {170, 219, 255, 255}, {170, 255, 0, 255}, {170, 255, 85, 255},
107 {170, 255, 170, 255}, {170, 255, 255, 255}, {255, 0, 0, 255},
108 {255, 0, 85, 255}, {255, 0, 170, 255}, {255, 0, 255, 255},
109 {255, 36, 0, 255}, {255, 36, 85, 255}, {255, 36, 170, 255},
110 {255, 36, 255, 255}, {255, 73, 0, 255}, {255, 73, 85, 255},
111 {255, 73, 170, 255}, {255, 73, 255, 255}, {255, 109, 0, 255},
112 {255, 109, 85, 255}, {255, 109, 170, 255}, {255, 109, 255, 255},
113 {255, 146, 0, 255}, {255, 146, 85, 255}, {255, 146, 170, 255},
114 {255, 146, 255, 255}, {255, 182, 0, 255}, {255, 182, 85, 255},
115 {255, 182, 170, 255}, {255, 182, 255, 255}, {255, 219, 0, 255},
116 {255, 219, 85, 255}, {255, 219, 170, 255}, {255, 219, 255, 255},
117 {255, 255, 0, 255}, {255, 255, 85, 255}, {255, 255, 170, 255},
118 {255, 255, 255, 255}};
120 static const int default_palette_size =
121 (int)(sizeof(default_palette_colors) / sizeof(SDL_Color));