diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2006-08-19 03:12:28 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2006-08-19 03:12:28 +0000 |
commit | 1fd361a1ea06e44286c213ca1f814f49306fdc43 (patch) | |
tree | 64c8c96cf54d8718847339a403e5e67b922e8c3f /converter/ppm/winico.h | |
download | netpbm-mirror-1fd361a1ea06e44286c213ca1f814f49306fdc43.tar.gz netpbm-mirror-1fd361a1ea06e44286c213ca1f814f49306fdc43.tar.xz netpbm-mirror-1fd361a1ea06e44286c213ca1f814f49306fdc43.zip |
Create Subversion repository
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@1 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/ppm/winico.h')
-rw-r--r-- | converter/ppm/winico.h | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/converter/ppm/winico.h b/converter/ppm/winico.h new file mode 100644 index 00000000..4b8ac38b --- /dev/null +++ b/converter/ppm/winico.h @@ -0,0 +1,88 @@ +#ifndef WINICO_H_INCLUDED +#define WINICO_H_INCLUDED + +/* A specification for the Windows icon format is at (2000.06.08) + + http://www.daubnet.com/formats/ICO.html + +*/ + +typedef unsigned char u1; +typedef unsigned short int u2; +typedef unsigned int u4; + +typedef struct MS_Ico_ * MS_Ico; +typedef struct IC_Entry_ * IC_Entry; +typedef struct IC_InfoHeader_ * IC_InfoHeader; +typedef struct IC_Color_ * IC_Color; +/* Not part of the spec, but useful in constructing the icon. */ +typedef struct IC_Palette_ * IC_Palette; +typedef struct ICON_bmp_ * ICON_bmp; + +struct MS_Ico_ { + u2 reserved; + u2 type; + u2 count; + IC_Entry * entries; +}; + + +struct IC_Entry_ { + u1 width; + u1 height; + /* + * color_count is actually a byte (u1)... but 0 = 256, so I've used a short (u2). + */ + u2 color_count; + u1 reserved; + u2 planes; + u2 bitcount; + u4 size_in_bytes; + u4 file_offset; + IC_InfoHeader ih; + IC_Color * colors; + /* + * Below here, I have useful fields which aren't in the spec, but + * save having to keep stoopid amounts of global data. + */ + u1 * andBitmap; /* Used in reader. */ + u1 * xorBitmap; + int xBytesXor; /* Not used in reading, but saved for writing. */ + int xBytesAnd; /* Not used in reading, but saved for writing. */ + u1 ** andBitmapOut; /* it's just easier to use a 2d array in the code.*/ + u1 ** xorBitmapOut; /* Sorry! :) */ +}; + +struct IC_InfoHeader_ { + u4 size; + u4 width; + u4 height; + u2 planes; + u2 bitcount; + u4 compression; + u4 imagesize; + u4 x_pixels_per_m; + u4 y_pixels_per_m; + u4 colors_used; + u4 colors_important; +}; + +struct IC_Color_ { + u1 red; + u1 green; + u1 blue; + u1 reserved; +}; + +struct IC_Palette_ { + u4 col_amount; + IC_Color * colors; +}; + +struct ICON_bmp_ { + int xBytes; + u4 size; /* just col_amount * height, but save calculating too often. */ + u1 ** data; +}; + +#endif |