GreCreateRectRegion
Appearance
GreCreateRectRegion creates a region by taking the OR of a series of rectangles. When no rectangles are specified (that is, cRect is 0), an empty region is created. If COM_TRANSFORM is not set, the function expects the points to be in device coordinates.
This function can be hooked by the presentation driver.
- Simulation support
- This function is simulated by a handling routine in the graphics engine.
Syntax
GreCreateRectRegion(hdc, paRegion, cRect, pInstance, lFunction);
Parameters
- hdc (HDC) - input
- Device context handle.
- paRegion (PRECT) - input
- Pointer to the region definition.
- This is a pointer to an array of rectangle structures, which defines the region. Each rectangle is described by a RECTL structure:
- xLeft
- Minimum x-coordinate of rectangle
- yBottom
- Minimum y-coordinate
- xRight
- Maximum x-coordinate of rectangle
- yTop
- Maximum y-coordinate
- For each rectangle, xRight must be equal to or greater than xLeft. yTop must be equal to or greater than yBottom. The bottom and left boundaries of each rectangle are part of the interior of the region; the top and right boundaries are not.
- cRect (LONG) - input
- Number of rectangles in the region definition.
- If this is 0, an empty region is created.
- pInstance (PVOID) - input
- Pointer to instance data.
- lFunction (ULONG) - input
- High-order WORD=flags; low-order WORD=NGreCreateRectRegion.
Returns
- rc (HRGN) - returns
- Return codes.
- On completion, the handling routine returns the region handle (hrgn), or RGN_ERROR if an error occurred.
- Possible Errors Detected: When an error is detected, the handling routine must call WinSetErrorInfo to post the condition. Error codes for conditions that the handling routine is expected to check include:
- PMERR_INSUFFICIENT_MEMORY
- PMERR_INV_COORDINATE
- PMERR_INV_HRGN
- PMERR_INV_LENGTH_OR_COUNT
- PMERR_INV_RECT
- Refer to the "Error Explanations" section in the Presentation Manager Programming Reference for further explanation.
Sample
#define INCL_GRE_REGIONS #include <os2.h> HDC hdc; /* Device context handle. */ PRECT paRegion; /* Pointer to the region definition. */ LONG cRect; /* Number of rectangles in the region definition. */ PVOID pInstance; /* Pointer to instance data. */ ULONG lFunction; /* High-order WORD=flags; low-order WORD=NGreCreateRectRegion. */ HRGN rc; /* Return codes. */ rc = GreCreateRectRegion(hdc, paRegion, cRect, pInstance, lFunction);