Basic File Format
Name | Size | Description |
---|
Reserved | 2 byte | =0 |
Type | 2 byte | =1 |
Count | 2 byte | Number of Icons in this file |
Entries | Count * 16 | List of icons |
| Width | 1 byte | Cursor Width (16, 32 or 64) |
| Height | 1 byte | Cursor Height (16, 32 or 64 , most commonly = Width) |
| ColorCount | 1 byte | Number of Colors (2,16, 0=256) |
| Reserved | 1 byte | =0 |
| Planes | 2 byte | =1 |
| BitCount | 2 byte | bits per pixel (1, 4, 8) |
| SizeInBytes | 4 byte | Size of (InfoHeader + ANDbitmap + XORbitmap) |
| FileOffset | 4 byte | FilePos, where InfoHeader starts |
repeated Count times |
InfoHeader | 40 bytes | Variant of BMP InfoHeader |
| Size | 4 bytes | Size of InfoHeader structure = 40 |
| Width | 4 bytes | Icon Width |
| Height | 4 bytes | Icon Height (added height of XOR-Bitmap and AND-Bitmap) |
| Planes | 2 bytes | number of planes = 1 |
| BitCount | 2 bytes | bits per pixel = 1, 4, 8 |
| Compression | 4 bytes | Type of Compression = 0 |
| ImageSize | 4 bytes | Size of Image in Bytes = 0 (uncompressed) |
| XpixelsPerM | 4 bytes | unused = 0 |
| YpixelsPerM | 4 bytes | unused = 0 |
| ColorsUsed | 4 bytes | unused = 0 |
| ColorsImportant | 4 bytes | unused = 0 |
Colors | NumberOfColors * 4 bytes | Color Map for XOR-Bitmap |
| Red | 1 byte | red component |
| Green | 1 byte | green component |
| Blue | 1 byte | blue component |
| reserved | 1 byte | =0 |
repeated NumberOfColors times |
XORBitmap | see below bitmap |
ANDBitmap | see below monochrome bitmap |
Raster Data encoding
The XOR Bitmap is stored as 1-bit, 4-bit or 8-bit uncompressed Bitmap using the same encoding as BMP files. The AND Bitmap is stored in as 1-bit uncompressed Bitmap.
Pixels are stored bottom-up, left-to-right. Pixel lines are padded with zeros to end on a 32bit (4byte) boundary. Every line will have the same number of bytes. Color indices are zero based, meaning a pixel color of 0 represents the first color table entry, a pixel color of 255 (if there are that many) represents the 256th entry.
Raster Data encoding for 1bit / black & white XORbitmaps and for the AND-bitmap
BitCount = 1 Compression = 0
Every byte holds 8 pixels, its highest order bit representing the leftmost pixel of those. There are 2 color table entries. Some readers will ignore them though, and assume that 0 is black and 1 is white. If you are storing black and white pictures you should stick to this, with any other 2 colors this is not an issue. Remember padding with zeros up to a 32bit boundary (This can be up to 31 zeros/pixels!)
Raster Data encoding for 4bit / 16 color XORbitmaps
BitCount = 4 Compression = 0
Every byte holds 2 pixels, its high-order 4 bits representing the left of those. There are 16 color table entries. These colors do not have to be the 16 MS-Windows standard colors. Padding each line with zeros up to a 32bit boundary will result in up to 28 zeros = 7 'wasted pixels'.
Raster Data encoding for 8bit / 256 color XORbitmaps
BitCount = 8 Compression = 0
Every byte holds 1 pixel. There are 256 color table entries. Padding each line with zeros up to a 32bit boundary will result in up to 3 bytes of zeros = 3 'wasted pixels'.