Basic Description
These files are used by Windows 3.x and Windows95 to display the mouse cursor. Win95 also uses ANI files for colored, animated mouse cursors. There may be more than one image in this file.Basic File Format
Name | Size | Description | |||
---|---|---|---|---|---|
Reserved | 2 byte | =0 | |||
Type | 2 byte | =2 | |||
Count | 2 byte | Number of Cursors in this file | |||
Entries | Count * 24 | List of cursors | |||
Width | 1 byte | Cursor Width (most commonly =32) | |||
Height | 1 byte | Cursor Height (most commonly =32) | |||
ColorCount | 1 byte | =0 ! | |||
Reserved | 1 byte | =0 | |||
XHotspot | 2 byte | Hotspot's X-Position | |||
YHotspot | 2 byte | Hotspot's Y-Position | |||
SizeInBytes | 4 byte | Size of (InfoHeader + ANDBitmap + XORBitmap) | |||
FileOffset | 4 byte | FilePos, where InfoHeader starts | |||
repeated Count times | |||||
InfoHeader | 40 byte | Variant of BMP InfoHeader | |||
Size | 4 bytes | Size of InfoHeader structure = 40 | |||
Width | 4 bytes | Cursor Width | |||
Height | 4 bytes | Cursor Height (added height of XORbitmap and ANDbitmap) | |||
Planes | 2 bytes | number of planes = 1 | |||
BitCount | 2 bytes | bits per pixel = 1 | |||
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 | 8 bytes | since BitsPerPixel = 1 this will always be 2 entries | |||
Color 0 Red | 1 byte | Background color red component =0 | |||
Color 0 Green | 1 byte | Background color green component =0 | |||
Color 0 Blue | 1 byte | Background color blue component =0 | |||
reserved | 1 byte | =0 | |||
Color 1 Red | 1 byte | Foreground color red component =255 | |||
Color 1 Green | 1 byte | Foreground color green component =255 | |||
Color 1 Blue | 1 byte | Foreground color blue component =255 | |||
reserved | 1 byte | =0 | |||
XORbitmap | see below monochrome bitmap | ||||
ANDbitmap | see below monochrome bitmap |
Raster Data encoding
Pixels are stored bottom-up, left-to-right in the same manner as monochrome BMPs. Pixel lines are padded with zeros to end on a 32bit (4byte) boundary. Every line will have the same number of bytes. Every byte holds 8 pixels, its highest order bit representing the leftmost pixel of those. Remember padding with zeros up to a 32bit boundary (This can be up to 31 zeros/pixels!). Although there are 2 color table entries, I haven't seen a file that uses them, since Windows seems to ignore its contents.Whenever Windows draws a cursor the ANDbitmap is applied to whatever is on the screen. After that, the XOR Bitmap is applied. Both bitmaps are encoded in the same scheme as monochrome BMPs. When there is more than one cursor in the file Windows uses the one that matches the system settings.
AND | XOR | Result | |
---|---|---|---|
0 | 0 | Black pixel | |
0 | 1 | White pixel | |
1 | 0 | Transparent Background pixel | |
1 | 1 | Inverted Background pixel |
Portability
Since CUR Files are a derivatives of BMPs they should be quite easily converted into monochrome BMPs with twice the cursor's height. Due to the XOR-AND-scheme which may not apply to other OS, these files are not very portable, and were never intended to be. 2byte and 4byte entries are stored in Intel order (Least significant byte first)Trademarks, Patents and Royalties
To my knowledge: none(please read the disclaimer)
Cross-Checking Software
This section is for programmers, who wish to cross-check their implementation with others. This is an incomplete list of programs, which are available as freeware / shareware / try-before-buy etc.The following software is able to decode CURs::
MS-Windows itself (obviously not freeware)
most resource construction sets (included in Windows Compilers)The following software is able to encode BMPs
most resource construction sets (included in Windows Compilers)