gpi12.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
GpiSetBitmapBits (1.2)
Function Group  Overview                          Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_GPIBITMAPS
 
LONG GpiSetBitmapBits(hps, iScanStart, cScans, pbBuffer, pbmi)
HPS hps;             /* presentation-space handle                     */
LONG iScanStart;     /* index of first scan line                      */
LONG cScans;         /* number of scan lines                          */
PBYTE pbBuffer;      /* address of buffer with bitmap data            */
PBITMAPINFO pbmi;    /* address of structure with bitmap header table */
 
The GpiSetBitmapBits function copies image data to a bitmap from the buffer
pointed to by pbBuffer. The function copies the image data to the bitmap
currently set for the presentation space. The presentation space must be
associated with a memory device context.
 
To copy the image data, the function needs the width and height of the
bitmap, the count of planes and adjacent color bits, and the array of RGB
color values for the bitmap pels. These values must be specified in the
fields of the structure pointed to by pbmi. An application must make sure
there is sufficient space in the structure to hold all elements of the array
of RGB color values. The number of elements in the array depends on the
format of the bitmap.
 
The buffer holding the image data must have sufficient image data to set all
pels in the bitmap. The number of bytes for the buffer is equal to the
number of scan lines to be copied, multiplied by the width of the bitmap in
bytes (multiplied by the number of adjacent color bits and rounded up to the
next multiple of 4), multiplied by the number of color planes. If the bitmap
width (in bytes) is not an exact multiple of 4, the function discards any
extra bits. If the format of the bitmap does not match the device format,
the function converts the bitmap. The function can convert standard formats
only.
 
Parameter   Description
────────────────────────────────────────────────────────────────────────────
 
hps         Identifies the presentation space.
 
iScanStart  Specifies the number of the first scan line to copy to the
            buffer. If it is zero, the function copies the first scan line
            in the bitmap.
 
cScans      Specifies the number of scan lines to copy.
 
pbBuffer    Points to the buffer that contains the image data for the
            bitmap.
 
pbmi        Points to the BITMAPINFO structure that contains the bitmap
            information table.
 
Return Value
 
The return value is the number of scan lines set, or GPI_ALTERROR if an
error occurred.
 
Errors
 
Use the WinGetLastError function to retrieve the error value, which may be
one of the following:
 
     PMERR_INCORRECT_DC_TYPE
     PMERR_INV_DC_TYPE
     PMERR_INV_HPS
     PMERR_INV_INFO_TABLE
     PMERR_INV_LENGTH_OR_COUNT
     PMERR_INV_SCAN_START
     PMERR_NO_BITMAP_SELECTED
     PMERR_PS_BUSY
 
See Also
 
GpiAssociate, GpiCreateBitmap, GpiLoadBitmap, WinGetLastError, BITMAPINFO