1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
/*
Copyright (C) 2009 Red Hat, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "common.h"
#include "resource.h"
#include "images/splash_image.c"
static const PixmapHeader splash_image = {
(uint8_t *)_splash_image.pixel_data,
_splash_image.width,
_splash_image.height,
_splash_image.width * 4,
};
#include "images/info_image.c"
static const PixmapHeader info_image = {
(uint8_t *)_info_image.pixel_data,
_info_image.width,
_info_image.height,
_info_image.width * 4,
};
#include "images/alt_image.c"
static const PixmapHeader alt_image = {
(uint8_t *)_alt_image.pixel_data,
_alt_image.width,
_alt_image.height,
_alt_image.width * 4,
};
typedef struct ResImage {
int id;
const PixmapHeader* image;
} ResImage;
static const ResImage res_image_map[] = {
{ SPLASH_IMAGE_RES_ID, &splash_image},
{ INFO_IMAGE_RES_ID, &info_image},
{ ALT_IMAGE_RES_ID, &alt_image},
{0, NULL},
};
const PixmapHeader *res_get_image(int id)
{
const ResImage *now = res_image_map;
for (; now->image; now++) {
if (now->id == id) {
return now->image;
}
}
return NULL;
}
#include "images/red_icon.c"
static const IconHeader red_icon = {
_red_icon.width,
_red_icon.height,
(uint8_t *)_red_icon.pixmap,
(uint8_t *)_red_icon.mask,
};
typedef struct ResIcon {
int id;
const IconHeader* icon;
} ResIcon;
static const ResIcon res_icon_map[] = {
{ RED_ICON_RES_ID, &red_icon},
{0, NULL},
};
const IconHeader *res_get_icon(int id)
{
const ResIcon *now = res_icon_map;
for (; now->icon; now++) {
if (now->id == id) {
return now->icon;
}
}
return NULL;
}
|