1 |
#include "builtinpix.h" |
2 |
|
3 |
Glib::RefPtr<Gdk::Pixbuf> redDot; |
4 |
Glib::RefPtr<Gdk::Pixbuf> yellowDot; |
5 |
Glib::RefPtr<Gdk::Pixbuf> blackLoop; |
6 |
Glib::RefPtr<Gdk::Pixbuf> blueHatchedPattern; |
7 |
Glib::RefPtr<Gdk::Pixbuf> grayBlueHatchedPattern; |
8 |
Glib::RefPtr<Gdk::Pixbuf> grayLoop; |
9 |
|
10 |
extern const unsigned char red_dot_rgba[]; |
11 |
extern const unsigned char yellow_dot_rgba[]; |
12 |
extern const unsigned char black_loop_rgba[]; |
13 |
extern const unsigned char blue_hatched_pattern_rgba[]; |
14 |
extern const unsigned char grayblue_hatched_pattern_rgba[]; |
15 |
extern const unsigned char gray_loop_rgba[]; |
16 |
|
17 |
extern const int red_dot_rgba_size; |
18 |
extern const int yellow_dot_rgba_size; |
19 |
extern const int black_loop_rgba_size; |
20 |
extern const int blue_hatched_pattern_rgba_size; |
21 |
extern const int grayblue_hatched_pattern_rgba_size; |
22 |
extern const int gray_loop_rgba_size; |
23 |
|
24 |
static struct _BuiltInPixMap { |
25 |
Glib::RefPtr<Gdk::Pixbuf>* pixbuf; |
26 |
const unsigned char* raw; |
27 |
int size; |
28 |
} builtInPixMap[] = { |
29 |
{ &redDot, red_dot_rgba, red_dot_rgba_size }, |
30 |
{ &yellowDot, yellow_dot_rgba, yellow_dot_rgba_size }, |
31 |
{ &blackLoop, black_loop_rgba, black_loop_rgba_size }, |
32 |
{ &blueHatchedPattern, blue_hatched_pattern_rgba, blue_hatched_pattern_rgba_size }, |
33 |
{ &grayBlueHatchedPattern, grayblue_hatched_pattern_rgba, grayblue_hatched_pattern_rgba_size }, |
34 |
{ &grayLoop, gray_loop_rgba, gray_loop_rgba_size }, |
35 |
}; |
36 |
|
37 |
void loadBuiltInPix() { |
38 |
if (*builtInPixMap[0].pixbuf) return; |
39 |
const int n = sizeof(builtInPixMap) / sizeof(_BuiltInPixMap); |
40 |
for (int i = 0; i < n; ++i) { |
41 |
*builtInPixMap[i].pixbuf = Gdk::Pixbuf::create_from_inline( |
42 |
builtInPixMap[i].size, |
43 |
builtInPixMap[i].raw |
44 |
); |
45 |
} |
46 |
} |