Jump to content

GreRectInRegion

From EDM2
Revision as of 01:30, 25 March 2020 by Ak120 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

GreRectInRegion checks whether any part of a given rectangle lies within the specified region. GreRectInRegion raises an error if hrgn is the handle of the currently selected clip 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

GreRectInRegion(hdc, hrgn, prclRect, pInstance, lFunction)

Parameters

hdc (HDC) - input
Device context handle.
hrgn (HRGN) - input
Region handle.
prclRect (PRECTL) - input
Pointer to rectangle in device coordinates.
RECTL structure:
  • xLeft Minimum x-coordinate of rectangle
  • yBottom Minimum y-coordinate
  • xRight Maximum x-coordinate of rectangle
  • yTop Maximum y-coordinate
The rectangle passed is considered "exclusive" on the right and top sides. If the rectangle represents the bounding box of a graphic object to be drawn, the drawing might include the right and top sides. In this case, the caller should "inflate" the top and right sides by one unit in device-coordinate space.
pInstance (PVOID) - input
Pointer to instance data.
lFunction (ULONG) - input
High-order WORD=flags; low-order WORD=NGreRectInRegion.

Return Code

rc (LONG) - returns
Return codes.
This function returns an integer (lInside) indicating whether the rectangle is inside the region:
  • RRGN_ERROR Error
  • RRGN_INSIDE All in region
  • RRGN_PARTIAL Partially in region
  • RRGN_OUTSIDE Not in region
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_INV_COORDINATE
  • 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.

Declaration

#define INCL_GRE_REGIONS
#include <os2.h>

HDC       hdc;        /*  Device context handle. */
HRGN      hrgn;       /*  Region handle. */
PRECTL    prclRect;   /*  Pointer to rectangle in device coordinates. */
PVOID     pInstance;  /*  Pointer to instance data. */
ULONG     lFunction;  /*  High-order WORD=flags; low-order WORD=NGreRectInRegion. */
LONG      rc;         /*  Return codes. */

rc = GreRectInRegion(hdc, hrgn, prclRect, pInstance, lFunction);