Introduction
The OS/2 colour pointer is a colour mouse pointer stored as a BMP file with the type
code CP. It is laid out exactly like a
colour OS/2 icon: a 1-bit bitmap of AND and XOR
masks that decides where the pointer is transparent, then a colour image for the rest.
The file header carries the hotspot, the pixel that marks where the pointer points.
Pointer files are usually named .ptr. A file with versions for several
screens is a bitmap array whose entries are
CP images.
Structure
The parts are those of a colour icon: two sets of
headers, each starting with CP, then the mask bits and the colour image.
The hotspot is in the first file header, in the fields described on the
pointer page. All numbers are little-endian.
0File headerCP, size, hotspot and the offset of the masks14 bytes14DIB header and two-entry colour table for the masks, in the 12-byte or OS/2 2.x layoutvaries…Second file headerCPagain, with the offset of the colour image14 bytes…DIB header and colour table for the colour imagevaries…Masks first the XOR mask, then the AND mask, then the colour image, each at the offset in its file headervaries
The type code is the constant BFT_COLORPOINTER, and cbSize
is the size of the header structure, as IBM defines it. The hotspot is an offset from the
pointer’s lower-left corner, in pixels. The colour image’s DIB header gives its real
size: IBM says its cy “must be the real height”, half the masks’, and its
width is the masks’ width. The explorer reports a colour image of another size and a
hotspot outside the pointer.
How the masks and colour combine
IBM’s table for colour icons and pointers gives what each pair of mask bits does with the colour image:
| XOR | AND | Result |
|---|---|---|
1 | 1 | The screen, inverted |
0 | 0 | The colour image’s pixel |
0 | 1 | Transparent: the screen shows through |
1 | 0 | The colour image’s pixel |
The explorer draws the pointer this way, with inverted pixels shown in magenta, as they cannot be drawn without a screen behind them.
Telling it apart
The file starts with CP (43 50). After the first DIB header
and its two-entry colour table comes a second file header, also starting with
CP. Apart from the type code it is identical to a
colour icon. A black and white
pointer starts with PT and has only
one file header.
Variants
- Windows bitmap (BM) – Windows 3.0 and later: a 40- to 124-byte header
- Windows 2 and OS/2 1.x bitmap (BM) – the first bitmaps, with a 12-byte header
- OS/2 2.x bitmap (BM) – a 16- to 64-byte header, with Huffman 1D and RLE24
- OS/2 bitmap array (BA) – several OS/2 bitmaps, icons or pointers for different screens, chained in one file
- OS/2 icon (IC) – a black and white OS/2 icon: AND and XOR masks in one 1-bit bitmap
- OS/2 colour icon (CI) – a colour OS/2 icon: a 1-bit mask bitmap followed by a colour image
- OS/2 pointer (PT) – a black and white OS/2 mouse pointer, with its hotspot in the header
- OS/2 colour pointer (CP) – a colour OS/2 mouse pointer: masks, a colour image and a hotspot