2.2.2.9 DeviceIndependentBitmap Object

The DeviceIndependentBitmap (DIB) Object defines an image in device-independent bitmap (DIB) format.


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

DIBHeaderInfo (variable)

...

Colors (variable)

...

BitmapBuffer (variable)

...

DIBHeaderInfo (variable): Either a BitmapCoreHeader Object (section 2.2.2.2) or a BitmapInfoHeader Object (section 2.2.2.3) that specifies information about the image.

The first 32 bits of this field is the HeaderSize value. If it is 0x0000000C, then this is a BitmapCoreHeader; otherwise, this is a BitmapInfoHeader.

Colors (variable): An optional array of either RGBQuad Objects (section 2.2.2.20) or 16-bit unsigned integers that define a color table.

The size and contents of this field SHOULD be determined from the metafile record or object that contains this DeviceIndependentBitmap Object and from information in the DIBHeaderInfo field. See ColorUsage Enumeration (section 2.1.1.6) and BitCount Enumeration (section 2.1.1.3) for additional details.

BitmapBuffer (variable): A buffer containing the image, which is not required to be contiguous with the DIB header, unless this is a packed bitmap.


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

UndefinedSpace (variable)

...

aData (variable)

...

UndefinedSpace (variable): An optional field that MUST be ignored. If this DIB is a packed bitmap, this field MUST NOT be present.

aData (variable): An array of bytes that define the image.

The size and format of this data is determined by information in the DIBHeaderInfo field. If it is a BitmapCoreHeader, the size in bytes MUST be calculated as follows:

 (((Width * Planes * BitCount + 31) & ~31) / 8) * abs(Height)

This formula SHOULD also be used to calculate the size of aData when DIBHeaderInfo is a BitmapInfoHeader Object, using values from that object, but only if its Compression value is BI_RGB, BI_BITFIELDS, or BI_CMYK.

Otherwise, the size of aData MUST be the BitmapInfoHeader Object value ImageSize.