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