PBITMAP

typedef struct tagPBITMAP {
    short bmType;         // bitmap type; must be zero
    short bmWidth;        // width of the bitmap, in pixels
    short bmHeight;       // height of the bitmap, in pixels
    short bmWidthBytes;   // see below
    BYTE  bmPlanes;       // number of color planes
    BYTE  bmBitsPixel;    // number of color bits for each pixel
    long  bmBits;         // see below
    long  bmWidthPlanes;  // see below
    long  bmlpPDevice;    // see below
    short bmSegmentIndex; // see below
    short bmScanSegment;  // see below
    short bmFillBytes;    // see below
    short reserved1;      // reserved; do not use
    short reserved2;      // reserved; do not use
} PBITMAP;
 

Specifies the dimensions, attributes, and bits of a physical bitmap.

bmWidthBytes
Number of bytes in each raster line of the bitmap. The number of bytes must be even; all raster lines must be aligned on 16-bit boundaries.
bmBits
Address of an array of bits that specifies the pixels of the bitmap. The array must be aligned on a 16-bit boundary.
bmWidthPlanes
Size, in bytes, of each color plane. It is equal to the product of bmWidthBytes*bmHeight.
bmlpPDevice
Address of the PDEVICE structure that specifies the device for which this bitmap is compatible.
bmSegmentIndex
Segment or selector offset for segments in the bitmap array. If the bitmap is less than 64K, this member is zero.
bmScanSegment
The number of raster lines contained in each segment of the bitmap array. If the bitmap is less than 64K, this member is zero.
bmFillBytes
The number of extra bytes in each segment. GDI allocates storage for the bitmap array in 16-byte multiples.

If the bitmap bits exceed 64K, GDI allocates a two or more segments to store the bitmap. In such cases, the bmScanSegment member specifies the number of raster lines stored in each segment, with bmFillBytes that specifies any additional bytes needed to round the segment size out to a multiple of 16; no segment contains more than 64K. The total number of segments is equal to the quotient of bmHeight divided by bmScanSegment rounded up by one if the remainder is not zero. The selector (or segment address) for each segment is a multiple of bmSegmentIndex.

GDI stores the bits in the bitmap array as raster lines, with the raster line representing the top of the bitmap stored first. If the bitmap has more than one plane, GDI stores the first raster lines for all planes at the beginning of the array, stores the second raster lines next, and so on. The following shows the layout for a four-plane bitmap:

Plane 0, first raster line
Plane 1, first raster line
Plane 2, first raster line
Plane 3, first raster line
Plane 0, second raster line
        .
        .
        .
Plane 0, last raster line
Plane 1, last raster line
Plane 2, last raster line
Plane 3, last raster line

If the bitmap array exceeds 64K, GDI splits the raster lines across several segments but retains the storage order, placing the first raster lines in the first segment and the last raster lines in the last segment. When GDI splits the raster lines, it ensures that matching raster lines from the various planes are always in the same segment. If necessary, GDI leaves a number of empty bytes (as specified by bmFillBytes) at the end of the segment to round out the segment size to a multiple of 16.

See Also

PDEVICE