Introduction
The OS/2 pointer is a black and white mouse pointer stored as a BMP file with the type
code PT. It is laid out exactly like a
black and white OS/2 icon: one 1-bit bitmap twice
the pointer’s height, holding an AND mask and an XOR mask. The two fields that a bitmap
reserves give 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
PT or colour pointer images.
Structure
The parts are those of a black and white icon, and the masks combine the same way: black, white, transparent or inverted. All numbers are little-endian.
0File headerPT, size, hotspot and the offset of the pixels14 bytes14DIB header width, double height, 1 bit per pixel, in the 12-byte or OS/2 2.x layout12 to 64 bytes…Colour table two entries, black and white, of 3 or 4 bytes each6 or 8 bytes…Masks 1-bit rows padded to 4 bytes: first the XOR mask, then the AND mask (see How the masks combine)varies
File header
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
| 0 | 2 | char[2] | usType | The signature PT (50 54), the constant BFT_POINTER. |
| 2 | 4 | u32 | cbSize | IBM defines this as the size of the header structure, the file header with the DIB header it holds. Some programs write something else, so readers should not depend on it. |
| 6 | 2 | i16 | xHotspot | The hotspot’s x offset from the pointer’s lower-left corner, in pixels. |
| 8 | 2 | i16 | yHotspot | The hotspot’s y offset from the pointer’s lower-left corner, in pixels, counted upwards. |
| 10 | 4 | u32 | offBits | The offset from the start of the file to the mask bits. |
IBM gives the hotspot as an offset “from its lower left corner (in pels)” (WinCreatePointer), the origin of every Presentation Manager bitmap. The explorer reports a hotspot outside the pointer.
Telling it apart
The file starts with PT (50 54), and its DIB header gives 1
bit per pixel with a height twice the width. Apart from the type code it is identical
to an OS/2 icon. A
colour pointer starts with CP and
has a second 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