After the 78-byte DiskObject come the blocks its pointer fields announce. Nothing in the file gives their offsets: a reader goes through them in a fixed order, reading each one only when its pointer is non-zero, and works out each block’s length from its contents. All numbers are big-endian.
Order
| Block | Present when | Size |
|---|---|---|
| DiskObject | always | 78 bytes |
| drawer data | do_DrawerData is non-zero | 56 bytes |
| normal image | GadgetRender is non-zero | 20 bytes and the bitplanes |
| selected image | SelectRender is non-zero | 20 bytes and the bitplanes |
| default tool | do_DefaultTool is non-zero | a string |
| tool types | do_ToolTypes is non-zero | a count and strings |
| tool window | do_ToolWindow is non-zero | a string |
| Workbench 2 drawer data | do_DrawerData is non-zero and the revision is 1 | 6 bytes |
| colour icon | bytes remain; starts FORM | an IFF FORM ICON; see Colour icons |
Drawer data
Disks, drawers and the Trashcan store the window they open in: an Intuition
NewWindow structure followed by two longs, 56 bytes in all, straight after
the DiskObject at offset 78. Offsets below are within the block.
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
| 0 | 2 | i16 | LeftEdge | the window’s position on the screen |
| 2 | 2 | i16 | TopEdge | |
| 4 | 2 | i16 | Width | the window’s size |
| 6 | 2 | i16 | Height | |
| 8 | 1 | u8 | DetailPen | window pens; Workbench sets its own |
| 9 | 1 | u8 | BlockPen | |
| 10 | 4 | u32 | IDCMPFlags | Intuition settings, replaced by Workbench when it opens the window |
| 14 | 4 | u32 | Flags | |
| 18 | 20 | 5 pointers | FirstGadget, CheckMark, Title, Screen, BitMap | meaningless in a file; ignored |
| 38 | 2 | i16 | MinWidth | size limits |
| 40 | 2 | i16 | MinHeight | |
| 42 | 2 | u16 | MaxWidth | |
| 44 | 2 | u16 | MaxHeight | |
| 46 | 2 | u16 | Type | the screen type |
| 48 | 4 | i32 | dd_CurrentX | how far the window’s contents are scrolled |
| 52 | 4 | i32 | dd_CurrentY |
Workbench 2 drawer data
An icon of revision 1 with drawer data has 6 more bytes after the strings, the rest of
the Workbench 2 DrawerData structure:
| Size | Type | Name | Values |
|---|---|---|---|
| 4 | u32 | dd_Flags | 0 default (show icons only), 1 show only icons, 2 show all files |
| 2 | u16 | dd_ViewModes | 0 default (as the parent), 1 icons, 2 text by name, 3 text by date, 4 text by size, 5 text by type |
Images
Each image is a 20-byte Intuition Image structure followed by its
bitplanes.
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
| 0 | 2 | i16 | LeftEdge | offset of the image within the gadget; usually 0 |
| 2 | 2 | i16 | TopEdge | usually 0 |
| 4 | 2 | i16 | Width | in pixels |
| 6 | 2 | i16 | Height | in pixels |
| 8 | 2 | i16 | Depth | the number of bitplanes: 2 for standard icons, up to 8 |
| 10 | 4 | pointer | ImageData | non-zero; the bitplanes follow |
| 14 | 1 | u8 | PlanePick | which screen bitplanes the image’s planes are drawn into, one bit per screen plane |
| 15 | 1 | u8 | PlaneOnOff | for screen planes not picked: 1 sets them, 0 clears them |
| 16 | 4 | pointer | NextImage | ignored |
The bitplanes come one after the other, plane 0 first. Each plane is
Height rows, and each row is ceil(Width / 16) 16-bit words,
so the data is ceil(Width / 16) × 2 × Height ×
Depth bytes. In each word the most significant bit is the leftmost pixel.
A pixel’s colour number takes bit 0 from plane 0, bit 1 from plane 1, and so on, and
selects a Workbench screen pen.
With the usual PlanePick of all ones for the image’s planes, the colour
number is the pen. In general, image plane k goes to the k-th
screen plane whose bit is set in PlanePick, and every other screen plane
takes its bit from PlaneOnOff.
The image has no palette: it uses the Workbench screen’s colours. A standard
two-plane icon has four colours. Under Workbench 1.x these are by default blue,
white, black and orange; under Workbench 2 and later grey, black, white and blue.
The exact shades are the user’s preference settings. The defaults, from the AmigaFFH package’s amiga_palettes
(Pepijn de Vries): Workbench 1.x #0055AA #FFFFFF #000022 #FF8800; Workbench 2 and later
#AAAAAA #000000 #FFFFFF #6688BB, and the four MagicWB colours for pens 4 to 7:
#7B7B7B #AFAFAF #AA907C #FFA997. No source read defines a pen above 7.
The selected image, when present, has the same layout. It is shown instead of the
normal one when the gadget flags say GADGHIMAGE.
Strings and tool types
A string is a 32-bit length, counting the terminating zero byte, then that many bytes, the last of them zero. The text is in the Amiga’s ISO 8859-1 character set.
The tool types start with a 32-bit value equal to 4 × (n + 1), the size of the array of n string pointers plus its closing null, and then n strings in the form above. A value of 4 means an empty list.
Tool types are free-form settings for the program, by convention
NAME=value or a bare NAME, such as
FILETYPE=ILBM or DONOTWAIT. A tool type in brackets, such as
(CX_POPUP=NO), is a convention for one that is switched off. NewIcons
store their colour images as extra tool types; see
Colour icons.
Example
The bytes after the header of a tool icon with one 2-plane, 32 × 16 image, a tool type and no drawer data:
| Offset | Bytes | Meaning |
|---|---|---|
| 78 | 00 00 00 00 00 20 00 10 00 02 | image: left 0, top 0, 32 × 16, depth 2 |
| 88 | non-zero, 03 00, 00 00 00 00 | image data follows; PlanePick 3, PlaneOnOff 0; no next image |
| 98 | 128 bytes | 2 planes × 16 rows × 2 words × 2 bytes |
| 226 | 00 00 00 08 | tool types: 8 = 4 × (1 + 1), one string |
| 230 | 00 00 00 0A | string length: 10, counting the zero byte |
| 234 | 44 4F 4E 4F 54 57 41 49 54 00 | DONOTWAIT and a zero byte |
The file ends at offset 244, unless a colour icon follows.