GreCombineRegion
Appearance
GreCombineRegion combines two regions to make a third. The destination region can be the same as one of the source regions. An error is raised when any one of the specified regions is currently selected as the clip region. All source and target regions must be of the same device class.
This function can be hooked by the presentation driver.
- Simulation support
- This function is simulated by a handling routine in the graphics engine.
Syntax
GreCombineRegion(hdc, hrgnDst, hrgnSrc1, hrgnSrc2, cmdMode, pInstance, lFunction);
Parameters
- hdc (HDC) - input
- Device context handle.
- hrgnDst (HRGN) - input
- Destination region handle.
- hrgnSrc1 (HRGN) - input
- First region handle.
- hrgnSrc2 (HRGN) - input
- Second region handle.
- cmdMode (LONG) - input
- Method of combination.
- CRGN_OR
- Union of hrgnSrc1 and hrgnSrc2.
- CRGN_COPY
- Uses hrgnSrc1 only. hrgnSrc2 is ignored.
- CRGN_XOR
- Symmetric difference of hrgnSrc1 and hrgnSrc2.
- CRGN_AND
- Intersection of hrgnSrc1 and hrgnSrc2.
- CRGN_DIFF
- Uses hrgnSrc1 and not (hrgnSrc2).
- pInstance (PVOID) - input
- Pointer to instance data.
- lFunction (ULONG) - input
- High-order WORD=flags; low-order WORD=NGreCombineRegion.
Returns
- rc (LONG) - returns
- This function returns an integer (lComplexity) indicating the complexity of the new region:
- RGN_ERROR
- Error
- RGN_NULL
- Null region
- RGN_RECT
- Rectangular region
- RGN_COMPLEX
- Complex region (more than 1 rectangle)
- 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_HRGN_BUSY
- PMERR_INSUFFICIENT_MEMORY
- PMERR_INV_COORDINATE
- PMERR_INV_HRGN
- PMERR_INV_LENGTH_OR_COUNT
- PMERR_INV_RECT
- PMERR_REGION_IS_CLIP_REGION
- 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. */ HRGN hrgnDst; /* Destination region handle. */ HRGN hrgnSrc1; /* First region handle. */ HRGN hrgnSrc2; /* Second region handle. */ LONG cmdMode; /* Method of combination. */ PVOID pInstance; /* Pointer to instance data. */ ULONG lFunction; /* High-order WORD=flags; low-order WORD=NGreCombineRegion. */ LONG rc; rc = GreCombineRegion(hdc, hrgnDst, hrgnSrc1, hrgnSrc2, cmdMode, pInstance, lFunction);