GpiSetBitmapDimension

This function associates a width and height with a bit map, in units of 0.1 millimeter.

Syntax
GpiSetBitmapDimension(hbm, psizlBitmapDimension)

Parameters

 * hbm (HBITMAP) - input:Bit-map handle.
 * psizlBitmapDimension (PSIZEL) - input : Width and height of bit map.
 * The width and height, respectively, of the bit map in units of 0.1 millimeter.

Return Code

 * rc (BOOL) - returns : Success indicator.
 * TRUE : Successful completion
 * FALSE : Error occurred.

Errors
Possible returns from WinGetLastError
 * PMERR_INV_HBITMAP (0x207B) : An invalid bit-map handle was specified.
 * PMERR_HBITMAP_BUSY (0x2032) : An internal bit map busy error was detected. The bit map was locked by one thread during an attempt to access it from another thread.

Remarks
The values set are not used internally by the system, but are retained with the bit map and can be retrieved with GpiQueryBitmapDimension.

Example Code
This example uses the GpiSetBitmap and GpiSetBitmapDimension function to set a newly created bit map in the device context for the associated presentation space. Once set, the example initializes the bit-map image by drawing in the presentation space. 
 * 1) define INCL_GPIBITMAPS
 * 2) define INCL_GPIPRIMITIVES
 * 3) include 

HPS hps; /* Presentation space handle */ BOOL fSuccess; /* Success indicator */ BITMAPINFOHEADER2 bmp = {12, 64, 64, 1, 1};/* 64x64 mono bit map */ HBITMAP hbm, hbmOld; POINTL ptlStart = { 0, 0 }; POINTL aptlTriangle[3] = { 32, 32, 63, 63, 0, 0 }; POINTL ptl = { 63, 63 }; SIZEL sizlBitmapDimension = {100, 100}; /* The width and height, */ /* respectively, of the bit */ /* map in units of 0.1 */ /* millimeter. */ hbm = GpiCreateBitmap(hps,                     &bmp,                      0L,                      NULL,                      NULL); /* Set the bit map and draw in it. */

fSuccess = GpiSetBitmapDimension(hbm,                                &sizlBitmapDimension); hbmOld = GpiSetBitmap(hps, hbm); /* sets bit map in device context */

GpiMove(hps, &ptlStart);

GpiBox(hps, DRO_FILL, &ptl, 0L, 0L); /* fills in the bit map */

GpiPolyLine(hps, /* draws a triangle */           1L,            aptlTriangle);

GpiSetBitmap(hps, hbmOld); /* restores the old bit map*/ 

Related Functions

 * GpiBitBlt
 * GpiCreateBitmap
 * GpiDeleteBitmap
 * GpiDrawBits
 * GpiLoadBitmap
 * GpiQueryBitmapBits
 * GpiQueryBitmapDimension
 * GpiQueryBitmapHandle
 * GpiQueryBitmapParameters
 * GpiQueryDeviceBitmapFormats
 * GpiSetBitmap
 * GpiSetBitmapBits
 * GpiSetBitmapId
 * GpiWCBitBlt