Debian Codegraph @

converter/ppm/winico.h

raw symbols SCIP
1 #ifndef WINICO_H_INCLUDED
2 #define WINICO_H_INCLUDED
3
4 /* A specification for the Windows icon format is at (2000.06.08)
5
6 http://www.daubnet.com/formats/ICO.html
7
8 */
9
10 typedef unsigned char u1;
11 typedef unsigned short int u2;
12 typedef unsigned int u4;
13
14 typedef struct MS_Ico_ MS_Ico;
15 typedef struct IC_Entry_ IC_Entry;
16 typedef struct IC_InfoHeader_ IC_InfoHeader;
17 typedef struct IC_Color_ IC_Color;
18 /* Not part of the spec, but useful in constructing the icon. */
19 typedef struct IC_Palette_ IC_Palette;
20 typedef struct ICON_bmp_ ICON_bmp;
21
22 struct MS_Ico_ {
23 u2 reserved;
24 u2 type;
25 u2 count;
26 IC_Entry ** entries;
27 };
28
29
30 struct IC_Entry_ {
31 /*
32 * width, height, color_count are a byte in the format, but 0 = 256,
33 * so it takes a short (u2) to represent the value normally.
34 */
35 u2 width;
36 u2 height;
37 u2 color_count;
38 u1 reserved;
39 u2 planes;
40 u2 bitcount; /* 0, 1, 4, or 8 */
41 u4 size_in_bytes;
42 u4 file_offset;
43 IC_InfoHeader * ih;
44 IC_Color ** colors;
45 /*
46 * Below here, I have useful fields which aren't in the spec, but
47 * save having to keep stoopid amounts of global data.
48 */
49 u1 * andBitmap; /* Used in reader. */
50 u1 * xorBitmap;
51 int xBytesXor; /* Not used in reading, but saved for writing. */
52 int xBytesAnd; /* Not used in reading, but saved for writing. */
53 u1 ** andBitmapOut; /* it's just easier to use a 2d array in the code.*/
54 u1 ** xorBitmapOut; /* Sorry! :) */
55 };
56
57 struct IC_InfoHeader_ {
58 u4 size;
59 u4 width;
60 u4 height;
61 u2 planes;
62 u2 bitcount;
63 u4 compression;
64 u4 imagesize;
65 u4 x_pixels_per_m;
66 u4 y_pixels_per_m;
67 u4 colors_used;
68 u4 colors_important;
69 };
70
71 struct IC_Color_ {
72 u1 red;
73 u1 green;
74 u1 blue;
75 u1 reserved;
76 };
77
78 struct IC_Palette_ {
79 u4 col_amount;
80 IC_Color ** colors;
81 };
82
83 struct ICON_bmp_ {
84 int xBytes;
85 u4 size; /* just col_amount * height, but save calculating too often. */
86 u1 ** data;
87 };
88
89 #endif