Windows API Reference

Microsoft Documentation

BITMAP Structure

The BITMAP structure contains information about a bitmap (a device-independent bitmap or DIB).

Syntax

typedef struct tagBITMAP {
    LONG         bmType;
    LONG         bmWidth;
    LONG         bmHeight;
    LONG         bmWidthBytes;
    WORD         bmPlanes;
    WORD         bmBitsPixel;
    LPVOID       bmBits;
} BITMAP, *PBITMAP, NEAR *NPBITMAP, FAR *LPBITMAP;

Members

Member Description
bmType Specifies the bitmap type. This member must be zero.
bmWidth Specifies the width of the bitmap, in pixels.
bmHeight Specifies the height of the bitmap, in pixels.
bmWidthBytes Specifies the width of the bitmap, in bytes. This value must be a multiple of 4.
bmPlanes Specifies the number of color planes in the bitmap. This value must be 1.
bmBitsPixel Specifies the number of bits per pixel.
bmBits Pointer to the bitmap memory. If this member is NULL, the memory for the bitmap is allocated as part of the structure.

Remarks

The BITMAP structure is used by the following GDI functions:

The bmWidthBytes member specifies the number of bytes in each raster scanline. A scanline is a horizontal row of pixels. The value of bmWidthBytes must be a multiple of 4.

The bmPlanes member specifies the number of color planes. For device-independent bitmaps (DIBs), this value is 1. For device-dependent bitmaps, it can be more than 1.

The bmBitsPixel member specifies the number of color bits used to represent each pixel. For DIBs, this value can be 1, 4, 8, 16, 24, or 32. For device-dependent bitmaps, it can also be 1, 4, 8, 16, 24, or 32.

The bmBits member is a pointer to the actual bitmap data. This data is an array of bytes that defines the bitmap pixels.

Requirements

Header: Wingdi.h

Library: Gdi32.lib

See Also