GpiQueryRegionBox: Difference between revisions
Appearance
Replaced content with "REVIEW - ERROR Category:WorkToDo" Tag: Replaced |
No edit summary |
||
Line 1: | Line 1: | ||
This function returns the dimensions of the smallest rectangle able to bound the region. | |||
[[Category: | ==Syntax== | ||
GpiQueryRegionBox(hps, hrgn, prclBound) | |||
==Parameters== | |||
;hps (HPS) - input | |||
:Presentation-space handle. | |||
:The region must be owned by the device identified by the currently associated device context. | |||
;hrgn (HRGN) - input | |||
:Region handle. | |||
;prclBound (PRECTL) - output | |||
:Bounding rectangle. | |||
==Returns== | |||
;lComplexity (LONG) - returns: Complexity of region and error indicators. | |||
:;RGN_NULL | |||
::Null region | |||
:;RGN_RECT | |||
::Rectangular region | |||
:;RGN_COMPLEX | |||
::Complex region | |||
:;RGN_ERROR | |||
::Error. | |||
==Errors== | |||
Possible returns from WinGetLastError | |||
;PMERR_INV_HPS (0x207F) | |||
:An invalid presentation-space handle was specified. | |||
;PMERR_PS_BUSY (0x20F4) | |||
:An attempt was made to access the presentation space from more than one thread simultaneously. | |||
;PMERR_INV_HRGN (0x2080) | |||
:An invalid region handle was specified. | |||
;PMERR_REGION_IS_CLIP_REGION (0x20F8) | |||
:An attempt was made to perform a region operation on a region that is selected as a clip region. | |||
;PMERR_HRGN_BUSY (0x2034) | |||
:An internal region busy error was detected. The region was locked by one thread during an attempt to access it from another thread. | |||
==Remarks== | |||
If the region is null, the rectangle returned has the left boundary equal to the right, and the top boundary equal to the bottom. | |||
It is invalid if the specified region is currently selected as the clip region (by GpiSetClipRegion). | |||
==Example Code== | |||
<pre> | |||
#define INCL_GPIREGIONS /* Or use INCL_GPI, INCL_PM, */ | |||
#include <os2.h> | |||
HPS hps; /* Presentation-space handle. */ | |||
HRGN hrgn; /* Region handle. */ | |||
PRECTL prclBound; /* Bounding rectangle. */ | |||
LONG lComplexity; /* Complexity of region and error indicators. */ | |||
lComplexity = GpiQueryRegionBox(hps, hrgn, | |||
prclBound); | |||
</pre> | |||
In this example we determine the dimensions of the smallest rectangle able to bound the region. | |||
<pre> | |||
#define INCL_GPIPREGIONS | |||
#include <OS2.H> | |||
LONG lResult; /* number of elements returned */ | |||
HPS hps; /* Presentation space handle. */ | |||
HRGN hrgn; /* region handle */ | |||
RECTL rclBound; /* bounding rectangle */ | |||
lResult = GpiQueryRegionBox(hps, | |||
(VOID *)hrgn, | |||
(PRECTL)&rclBound); | |||
</pre> | |||
[[Category:Gpi]] |
Latest revision as of 19:23, 7 April 2025
This function returns the dimensions of the smallest rectangle able to bound the region.
Syntax
GpiQueryRegionBox(hps, hrgn, prclBound)
Parameters
- hps (HPS) - input
- Presentation-space handle.
- The region must be owned by the device identified by the currently associated device context.
- hrgn (HRGN) - input
- Region handle.
- prclBound (PRECTL) - output
- Bounding rectangle.
Returns
- lComplexity (LONG) - returns
- Complexity of region and error indicators.
- RGN_NULL
- Null region
- RGN_RECT
- Rectangular region
- RGN_COMPLEX
- Complex region
- RGN_ERROR
- Error.
Errors
Possible returns from WinGetLastError
- PMERR_INV_HPS (0x207F)
- An invalid presentation-space handle was specified.
- PMERR_PS_BUSY (0x20F4)
- An attempt was made to access the presentation space from more than one thread simultaneously.
- PMERR_INV_HRGN (0x2080)
- An invalid region handle was specified.
- PMERR_REGION_IS_CLIP_REGION (0x20F8)
- An attempt was made to perform a region operation on a region that is selected as a clip region.
- PMERR_HRGN_BUSY (0x2034)
- An internal region busy error was detected. The region was locked by one thread during an attempt to access it from another thread.
Remarks
If the region is null, the rectangle returned has the left boundary equal to the right, and the top boundary equal to the bottom.
It is invalid if the specified region is currently selected as the clip region (by GpiSetClipRegion).
Example Code
#define INCL_GPIREGIONS /* Or use INCL_GPI, INCL_PM, */ #include <os2.h> HPS hps; /* Presentation-space handle. */ HRGN hrgn; /* Region handle. */ PRECTL prclBound; /* Bounding rectangle. */ LONG lComplexity; /* Complexity of region and error indicators. */ lComplexity = GpiQueryRegionBox(hps, hrgn, prclBound);
In this example we determine the dimensions of the smallest rectangle able to bound the region.
#define INCL_GPIPREGIONS #include <OS2.H> LONG lResult; /* number of elements returned */ HPS hps; /* Presentation space handle. */ HRGN hrgn; /* region handle */ RECTL rclBound; /* bounding rectangle */ lResult = GpiQueryRegionBox(hps, (VOID *)hrgn, (PRECTL)&rclBound);