Debian Codegraph @

converter/other/winicon.h

raw
1 #include "pm_c_util.h"
2
3 #define ICONDIR_TYPE_ICO (1)
4
5 /* windows icon structures */
6 struct IconDirEntry {
7 uint16_t width; /* image width in pixels 0 == 256 */
8 uint16_t height; /* image height in pixels 0 == 256 */
9 uint8_t color_count; /* 0 if bits_per_pixel >= 8 */
10 uint8_t zero; /* 0 */
11 uint16_t color_planes; /* 1 */
12 uint16_t bits_per_pixel; /* allowed values: 1, 4, 8, 16 or 32 (1) */
13 uint32_t size; /* size of image */
14 uint32_t offset; /* file offset of image */
15
16 uint16_t index; /* extra field (not in file) */
17 };
18
19 /* (1) This is from
20 * http://blogs.msdn.com/b/oldnewthing/archive/2010/10/19/10077610.aspx.
21 *
22 * However, the bpp value in the icon directory is used as a hint for
23 * image selection only. It seems to be legal to set this value to
24 * zero, and e.g. in SHELL32.DLL of Win98SE, there are many 8bpp
25 * images described as 24 bit images in the icon directory.
26 *
27 * The bpp value of image 1 in icon 150 in SHELL32.DLL of WinXP is 24
28 * (in header and BMP). This may be a bug, as the 32 x 32 x 8 image
29 * is missing, but it shows the Windows icon rendering engine is able
30 * to cope with 24 bit images).
31 *
32 * 16bpp icons are at least rare in the wild.
33 */
34 struct IconDir {
35 uint16_t zero; /* 0 */
36 uint16_t type; /* 1 */
37 uint16_t count; /* number of images in icon */
38
39 unsigned int entriesAllocCt; /* # of allocated slots in 'entries'*/
40 struct IconDirEntry * entries; /* one entry for each image */
41 };
42
43 /* BMP image structures */
44
45 struct BitmapInfoHeader {
46 uint32_t header_size; /* >= 40 */
47 int32_t bm_width;
48 int32_t bm_height;
49 uint16_t color_planes;
50 uint16_t bits_per_pixel;
51 uint32_t compression_method;
52 uint32_t image_size;
53 int32_t horizontal_resolution; /* pixels per meter (!) */
54 int32_t vertical_resolution; /* pixels per meter (!) */
55 uint32_t colors_in_palette;
56 uint32_t important_colors;
57
58 bool top_down; /* extra field (not in file) */
59
60 };
61
62 typedef enum {
63 BI_RGB = 0,
64 BI_BITFIELDS = 3
65
66 } BiCompression;
67
68 #define PNG_SIGNATURE { 0x89, 'P', 'N', 'G', '\r', '\n', 0x1A /* ^Z */, '\n' }
69
70 struct PngIhdr {
71 uint32_t length; /* 13 */
72 uint32_t signature; /* "IHDR" */
73 uint32_t width; /* image width in pixels */
74 uint32_t height; /* image height in pixels */
75 uint8_t bit_depth; /* depth per channel */
76 uint8_t color_type; /* recognized values: 0, 2, 3, 4 and 6 */
77 uint8_t compression;
78 uint8_t filter;
79 uint8_t interlace;
80 uint32_t crc;
81 };