GpiSetBitmapDimension: Difference between revisions
Appearance
mNo edit summary |
|||
Line 2: | Line 2: | ||
==Syntax== | ==Syntax== | ||
GpiSetBitmapDimension(hbm, psizlBitmapDimension) | |||
==Parameters== | ==Parameters== | ||
; hbm (HBITMAP) - input : Bit-map handle. | ;hbm (HBITMAP) - input:Bit-map handle. | ||
;psizlBitmapDimension (PSIZEL) - input : Width and height of bit map. | |||
; psizlBitmapDimension (PSIZEL) - input : Width and height of bit map. | :The width and height, respectively, of the bit map in units of 0.1 millimeter. | ||
: The width and height, respectively, of the bit map in units of 0.1 millimeter. | |||
==Return Code== | ==Return Code== | ||
; rc (BOOL) - returns : Success indicator. | ;rc (BOOL) - returns : Success indicator. | ||
* TRUE : Successful completion | *TRUE : Successful completion | ||
* FALSE : Error occurred. | *FALSE : Error occurred. | ||
==Errors== | ==Errors== | ||
Possible returns from WinGetLastError | Possible returns from WinGetLastError | ||
; PMERR_INV_HBITMAP (0x207B) : An invalid bit-map handle was specified. | ;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. | ;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== | ==Remarks== | ||
The values set are not used internally by the system, but are retained with the bit map and can be retrieved with GpiQueryBitmapDimension. | 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== | ==Example Code== | ||
This example uses the GpiSetBitmap and GpiSetBitmapDimension function to set a newly created bit map in the device context for the | 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. | ||
associated presentation space. Once set, the example initializes the bit-map image by drawing in the presentation space. | |||
<PRE> | <PRE> | ||
#define INCL_GPIBITMAPS | #define INCL_GPIBITMAPS | ||
Line 81: | Line 78: | ||
* [[GpiSetBitmapId]] | * [[GpiSetBitmapId]] | ||
* [[GpiWCBitBlt]] | * [[GpiWCBitBlt]] | ||
[[Category:Gpi]] | [[Category:Gpi]] |
Latest revision as of 03:01, 1 January 2020
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.
#define INCL_GPIBITMAPS #define INCL_GPIPRIMITIVES #include <OS2.H> 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*/