1 |
#include "builtinpix.h" |
2 |
#include "../compat.h" |
3 |
|
4 |
Glib::RefPtr<Gdk::Pixbuf> redDot; |
5 |
Glib::RefPtr<Gdk::Pixbuf> yellowDot; |
6 |
Glib::RefPtr<Gdk::Pixbuf> blackLoop; |
7 |
Glib::RefPtr<Gdk::Pixbuf> blueHatchedPattern; |
8 |
Glib::RefPtr<Gdk::Pixbuf> blueHatchedPattern2; |
9 |
Glib::RefPtr<Gdk::Pixbuf> grayBlueHatchedPattern; |
10 |
Glib::RefPtr<Gdk::Pixbuf> grayLoop; |
11 |
|
12 |
extern const unsigned char red_dot_rgba[]; |
13 |
extern const unsigned char yellow_dot_rgba[]; |
14 |
extern const unsigned char black_loop_rgba[]; |
15 |
extern const unsigned char blue_hatched_pattern_rgba[]; |
16 |
extern const unsigned char blue_hatched_pattern2_rgba[]; |
17 |
extern const unsigned char grayblue_hatched_pattern_rgba[]; |
18 |
extern const unsigned char gray_loop_rgba[]; |
19 |
|
20 |
extern const int red_dot_rgba_size; |
21 |
extern const int yellow_dot_rgba_size; |
22 |
extern const int black_loop_rgba_size; |
23 |
extern const int blue_hatched_pattern_rgba_size; |
24 |
extern const int blue_hatched_pattern2_rgba_size; |
25 |
extern const int grayblue_hatched_pattern_rgba_size; |
26 |
extern const int gray_loop_rgba_size; |
27 |
|
28 |
static struct _BuiltInPixMap { |
29 |
Glib::RefPtr<Gdk::Pixbuf>* pixbuf; |
30 |
const unsigned char* raw; |
31 |
int size; |
32 |
} builtInPixMap[] = { |
33 |
{ &redDot, red_dot_rgba, red_dot_rgba_size }, |
34 |
{ &yellowDot, yellow_dot_rgba, yellow_dot_rgba_size }, |
35 |
{ &blackLoop, black_loop_rgba, black_loop_rgba_size }, |
36 |
{ &blueHatchedPattern, blue_hatched_pattern_rgba, blue_hatched_pattern_rgba_size }, |
37 |
{ &blueHatchedPattern2, blue_hatched_pattern2_rgba, blue_hatched_pattern2_rgba_size }, |
38 |
{ &grayBlueHatchedPattern, grayblue_hatched_pattern_rgba, grayblue_hatched_pattern_rgba_size }, |
39 |
{ &grayLoop, gray_loop_rgba, gray_loop_rgba_size }, |
40 |
}; |
41 |
|
42 |
void loadBuiltInPix() { |
43 |
if (*builtInPixMap[0].pixbuf) return; |
44 |
const int n = sizeof(builtInPixMap) / sizeof(_BuiltInPixMap); |
45 |
for (int i = 0; i < n; ++i) { |
46 |
# if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && (GTKMM_MINOR_VERSION > 89 || (GTKMM_MINOR_VERSION == 89 && GTKMM_MICRO_VERSION >= 2))) // GTKMM >= 3.89.2 |
47 |
GdkPixbuf* pPixbuf = gdk_pixbuf_new_from_inline( |
48 |
builtInPixMap[i].size, |
49 |
builtInPixMap[i].raw, |
50 |
false, |
51 |
NULL |
52 |
); |
53 |
*builtInPixMap[i].pixbuf = Glib::wrap(pPixbuf); |
54 |
#else |
55 |
*builtInPixMap[i].pixbuf = Gdk::Pixbuf::create_from_inline( |
56 |
builtInPixMap[i].size, |
57 |
builtInPixMap[i].raw |
58 |
); |
59 |
#endif |
60 |
} |
61 |
} |