Jump to content

GreCopyClipRegion

From EDM2
Revision as of 02:12, 24 March 2020 by Ak120 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

GreCopyClipRegion copies the visible region, clip region, or DC region, and returns the complexity and bounds of the resulting region.

This function can be hooked by the presentation driver.

Simulation support
This function is simulated by a handling routine in the graphics engine.

Syntax

GreCopyClipRegion(hdc, hrgn, prclBounds, flOptions, pInstance, lFunction)

Parameters

hdc (HDC) - input
Device context handle.
hrgn (HRGN) - input
Visible region handle.
prclBounds (PRECTL) - input
Pointer to the bounding rectangle of the returned region.
The bounding rectangle is returned in the same coordinate system as the region defined by flOptions. This rectangle is inclusive at the bottom and left boundaries, exclusive at the top and right boundaries. When specified as NULL, the bounding rectangle is not returned.
flOptions (ULONG) - input
These flags determine the type of region to be returned in hrgn:
COPYCRGN_ALLINTERSECT
The function must return the intersection of all clipping. This value describes the DC region and is expressed in screen coordinates.
COPYCRGN_VISRGN
The function must return a copy of the visible region only. This value is returned in screen coordinates.
COPYCRGN_CLIPRGN
The function must return a copy of the clip region only. The clip region is expressed in device coordinates.
pInstance (PVOID) - input
Pointer to instance data.
lFunction (ULONG) - input
High-order WORD=flags; low-order WORD=NGreCopyClipRegion.

Returns

rc (LONG) - returns
Return codes.
This function returns an integer (lComplexity) indicating the complexity of the region:
  • RGN_ERROR Error
  • RGN_NULL Null region
  • RGN_RECT Rectangular region
  • RGN_COMPLEX Complex region (more than one 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_DEV_FUNC_NOT_INSTALLED
  • PMERR_HDC_BUSY
  • PMERR_HRGN_BUSY
  • PMERR_INSUFFICIENT_MEMORY
  • PMERR_INV_COORDINATE
  • PMERR_INV_HDC
  • PMERR_INV_HRGN
  • 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_CLIP
#include <os2.h>

HDC       hdc;         /*  Device context handle. */
HRGN      hrgn;        /*  Visible region handle. */
PRECTL    prclBounds;  /*  Pointer to the bounding rectangle of the returned region. */
ULONG     flOptions;   /*  These flags determine the type of region to be returned in hrgn: */
PVOID     pInstance;   /*  Pointer to instance data. */
ULONG     lFunction;   /*  High-order WORD=flags; low-order WORD=NGreCopyClipRegion. */
LONG      rc;          /*  Return codes. */

rc = GreCopyClipRegion(hdc, hrgn, prclBounds, flOptions, pInstance, lFunction);