Blame converter/ppm/winico.h
|
Packit |
78deda |
#ifndef WINICO_H_INCLUDED
|
|
Packit |
78deda |
#define WINICO_H_INCLUDED
|
|
Packit |
78deda |
|
|
Packit |
78deda |
/* A specification for the Windows icon format is at (2000.06.08)
|
|
Packit |
78deda |
|
|
Packit |
78deda |
http://www.daubnet.com/formats/ICO.html
|
|
Packit |
78deda |
|
|
Packit |
78deda |
*/
|
|
Packit |
78deda |
|
|
Packit |
78deda |
typedef unsigned char u1;
|
|
Packit |
78deda |
typedef unsigned short int u2;
|
|
Packit |
78deda |
typedef unsigned int u4;
|
|
Packit |
78deda |
|
|
Packit |
78deda |
typedef struct MS_Ico_ * MS_Ico;
|
|
Packit |
78deda |
typedef struct IC_Entry_ * IC_Entry;
|
|
Packit |
78deda |
typedef struct IC_InfoHeader_ * IC_InfoHeader;
|
|
Packit |
78deda |
typedef struct IC_Color_ * IC_Color;
|
|
Packit |
78deda |
/* Not part of the spec, but useful in constructing the icon. */
|
|
Packit |
78deda |
typedef struct IC_Palette_ * IC_Palette;
|
|
Packit |
78deda |
typedef struct ICON_bmp_ * ICON_bmp;
|
|
Packit |
78deda |
|
|
Packit |
78deda |
struct MS_Ico_ {
|
|
Packit |
78deda |
u2 reserved;
|
|
Packit |
78deda |
u2 type;
|
|
Packit |
78deda |
u2 count;
|
|
Packit |
78deda |
IC_Entry * entries;
|
|
Packit |
78deda |
};
|
|
Packit |
78deda |
|
|
Packit |
78deda |
|
|
Packit |
78deda |
struct IC_Entry_ {
|
|
Packit |
78deda |
u1 width;
|
|
Packit |
78deda |
u1 height;
|
|
Packit |
78deda |
/*
|
|
Packit |
78deda |
* color_count is actually a byte (u1)... but 0 = 256, so I've used a short (u2).
|
|
Packit |
78deda |
*/
|
|
Packit |
78deda |
u2 color_count;
|
|
Packit |
78deda |
u1 reserved;
|
|
Packit |
78deda |
u2 planes;
|
|
Packit |
78deda |
u2 bitcount;
|
|
Packit |
78deda |
u4 size_in_bytes;
|
|
Packit |
78deda |
u4 file_offset;
|
|
Packit |
78deda |
IC_InfoHeader ih;
|
|
Packit |
78deda |
IC_Color * colors;
|
|
Packit |
78deda |
/*
|
|
Packit |
78deda |
* Below here, I have useful fields which aren't in the spec, but
|
|
Packit |
78deda |
* save having to keep stoopid amounts of global data.
|
|
Packit |
78deda |
*/
|
|
Packit |
78deda |
u1 * andBitmap; /* Used in reader. */
|
|
Packit |
78deda |
u1 * xorBitmap;
|
|
Packit |
78deda |
int xBytesXor; /* Not used in reading, but saved for writing. */
|
|
Packit |
78deda |
int xBytesAnd; /* Not used in reading, but saved for writing. */
|
|
Packit |
78deda |
u1 ** andBitmapOut; /* it's just easier to use a 2d array in the code.*/
|
|
Packit |
78deda |
u1 ** xorBitmapOut; /* Sorry! :) */
|
|
Packit |
78deda |
};
|
|
Packit |
78deda |
|
|
Packit |
78deda |
struct IC_InfoHeader_ {
|
|
Packit |
78deda |
u4 size;
|
|
Packit |
78deda |
u4 width;
|
|
Packit |
78deda |
u4 height;
|
|
Packit |
78deda |
u2 planes;
|
|
Packit |
78deda |
u2 bitcount;
|
|
Packit |
78deda |
u4 compression;
|
|
Packit |
78deda |
u4 imagesize;
|
|
Packit |
78deda |
u4 x_pixels_per_m;
|
|
Packit |
78deda |
u4 y_pixels_per_m;
|
|
Packit |
78deda |
u4 colors_used;
|
|
Packit |
78deda |
u4 colors_important;
|
|
Packit |
78deda |
};
|
|
Packit |
78deda |
|
|
Packit |
78deda |
struct IC_Color_ {
|
|
Packit |
78deda |
u1 red;
|
|
Packit |
78deda |
u1 green;
|
|
Packit |
78deda |
u1 blue;
|
|
Packit |
78deda |
u1 reserved;
|
|
Packit |
78deda |
};
|
|
Packit |
78deda |
|
|
Packit |
78deda |
struct IC_Palette_ {
|
|
Packit |
78deda |
u4 col_amount;
|
|
Packit |
78deda |
IC_Color * colors;
|
|
Packit |
78deda |
};
|
|
Packit |
78deda |
|
|
Packit |
78deda |
struct ICON_bmp_ {
|
|
Packit |
78deda |
int xBytes;
|
|
Packit |
78deda |
u4 size; /* just col_amount * height, but save calculating too often. */
|
|
Packit |
78deda |
u1 ** data;
|
|
Packit |
78deda |
};
|
|
Packit |
78deda |
|
|
Packit |
78deda |
#endif
|