Windows DDB

From Just Solve the File Format Problem
(Difference between revisions)
Jump to: navigation, search
(Format)
 
Line 8: Line 8:
 
'''Windows DDB''' (Device-Dependent Bitmap), or '''Windows BMP v1''', is a graphics format associated with Microsoft Windows 1.0. It has only a little in common with the [[BMP]] formats that succeeded it.
 
'''Windows DDB''' (Device-Dependent Bitmap), or '''Windows BMP v1''', is a graphics format associated with Microsoft Windows 1.0. It has only a little in common with the [[BMP]] formats that succeeded it.
  
== Disambiguation ==
+
This article covers both a particular file format, and the BITMAP structure on which it is based (which may be embedded in other formats).
The term ''DDB'' is also used for the in-memory BITMAP structure used by the Windows API. This structure is not necessarily the same as the file format described in this article. (Maybe it is the same on old versions of Windows?)
+
  
Bitmap files in this format can be found in the Windows 2 DDK.
+
== BITMAP structure ==
 +
Originally named BITMAP, the structure is often called BITMAP16, to distinguish it from the versions of BITMAP associated with later operating systems.
  
This format is not the format saved by Windows 1.0 Paint. It is generated by ICONEDIT, the Windows 1.x icon / cursor / bitmap editor.
+
The structure is 14 bytes in size, with the last 4 bytes ("bmBits") being a memory pointer to the bitmap pixels.
  
== Format ==
+
In a file on disk, the bmBits field is usually not used (it's not clear whether some formats omit it entirely). The pixel data usually immediately follows.
Files begin with a 16-byte header, the last 14 bytes of which correspond to the BITMAP structure:
+
 
 +
BITMAP16:
 
{| class="wikitable"
 
{| class="wikitable"
 
! Offset
 
! Offset
 
! Type
 
! Type
 
! Meaning
 
! Meaning
|-
 
| 0x0000 || WORD || File type: 0x0002, RT_BITMAP. Top bit set if discardable.
 
 
|-  
 
|-  
| 0x0002 || WORD || bmType: Always 0x0000 for main memory bitmap
+
| 0x0000 || WORD || bmType
 
|-  
 
|-  
| 0x0004 || WORD || bmWidth: Width in pixels
+
| 0x0002 || WORD || bmWidth: Width in pixels
 
|-  
 
|-  
| 0x0006 || WORD || bmHeight: Height in pixels
+
| 0x0004 || WORD || bmHeight: Height in pixels
 
|-  
 
|-  
| 0x0008 || WORD || bmWidthBytes: Width of a line in bytes
+
| 0x0006 || WORD || bmWidthBytes: Width of a line in bytes
 
|-  
 
|-  
| 0x000A || BYTE || bmPlanes: Number of planes in bitmap
+
| 0x0008 || BYTE || bmPlanes: Number of planes in bitmap
 
|-  
 
|-  
| 0x000B || BYTE || bmBitsPixel: Number of bits per pixel
+
| 0x0009 || BYTE || bmBitsPixel: Number of bits per pixel
 +
|-
 +
| 0x00A0 || DWORD || bmBits: Pointer to pixels
 +
|}
 +
 
 +
Other formats that can contain this structure include [[HLP]] (via [[Segmented Hypergraphics|SHG]]), [[Microsoft Write|WRI]], [[Windows Metafile|WMF]], and resources in [[New Executable|EXE/NE]] files of that era.
 +
 
 +
== DDB file format ==
 +
Bitmap files in this format can be found in the Windows 2 DDK.
 +
 
 +
This format is not the format saved by Windows 1.0 Paint. It is generated by ICONEDIT, the Windows 1.x icon / cursor / bitmap editor.
 +
 
 +
Files begin with a 16-byte header, the last 14 bytes of which correspond to the BITMAP structure:
 +
{| class="wikitable"
 +
! Offset
 +
! Type
 +
! Meaning
 +
|-
 +
| 0x0000 || WORD || File type: 0x0002, RT_BITMAP. Top bit set if discardable.
 
|-  
 
|-  
| 0x000C || DWORD || bmBits: Always zero in disk file
+
| 0x0002 || BITMAP16 || Refer to BITMAP16, above.<br>bmType: Always 0x0000 for main memory bitmap<br>bmBits: Always zero in disk file
 
|}
 
|}
 
This is followed by the bitmap, in top-to-bottom order, with bmWidthBytes bytes per line.
 
This is followed by the bitmap, in top-to-bottom order, with bmWidthBytes bytes per line.
  
The [[WMF#Specifications|WMF specification]] defines a "Bitmap16" structure that seems to be this format, though without the "File type" field.
+
== Specifications ==
 +
* BITMAP16:
 +
** Refer to the [[WMF#Specifications|WMF specification]], "Bitmap16" structure
 +
** [https://github.com/wine-mirror/wine/blob/master/include/wine/wingdi16.h As defined by Wine]
  
 
== Software ==
 
== Software ==

Latest revision as of 15:58, 4 June 2019

File Format
Name Windows DDB
Ontology
Extension(s) .ddb, .bmp
PRONOM fmt/114
Released 1985

Windows DDB (Device-Dependent Bitmap), or Windows BMP v1, is a graphics format associated with Microsoft Windows 1.0. It has only a little in common with the BMP formats that succeeded it.

This article covers both a particular file format, and the BITMAP structure on which it is based (which may be embedded in other formats).

Contents

[edit] BITMAP structure

Originally named BITMAP, the structure is often called BITMAP16, to distinguish it from the versions of BITMAP associated with later operating systems.

The structure is 14 bytes in size, with the last 4 bytes ("bmBits") being a memory pointer to the bitmap pixels.

In a file on disk, the bmBits field is usually not used (it's not clear whether some formats omit it entirely). The pixel data usually immediately follows.

BITMAP16:

Offset Type Meaning
0x0000 WORD bmType
0x0002 WORD bmWidth: Width in pixels
0x0004 WORD bmHeight: Height in pixels
0x0006 WORD bmWidthBytes: Width of a line in bytes
0x0008 BYTE bmPlanes: Number of planes in bitmap
0x0009 BYTE bmBitsPixel: Number of bits per pixel
0x00A0 DWORD bmBits: Pointer to pixels

Other formats that can contain this structure include HLP (via SHG), WRI, WMF, and resources in EXE/NE files of that era.

[edit] DDB file format

Bitmap files in this format can be found in the Windows 2 DDK.

This format is not the format saved by Windows 1.0 Paint. It is generated by ICONEDIT, the Windows 1.x icon / cursor / bitmap editor.

Files begin with a 16-byte header, the last 14 bytes of which correspond to the BITMAP structure:

Offset Type Meaning
0x0000 WORD File type: 0x0002, RT_BITMAP. Top bit set if discardable.
0x0002 BITMAP16 Refer to BITMAP16, above.
bmType: Always 0x0000 for main memory bitmap
bmBits: Always zero in disk file

This is followed by the bitmap, in top-to-bottom order, with bmWidthBytes bytes per line.

[edit] Specifications

[edit] Software

  • The MSWrite decoder from libwps appears to have source code for reading embedded DDB objects.

[edit] Links

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox