GreGetRegionBox

From EDM2
Jump to: navigation, search

GreGetRegionBox loads the buffer pointed to by prclRect with the dimensions of the tightest rectangle around the region indicated by hrgn. Note that the rectangle is always returned in device coordinates. GreGetRegionBox raises an error when 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

GreGetRegionBox(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.
pInstance (PVOID) - input
Pointer to instance data.
lFunction (ULONG) - input
High-order WORD=flags; low-order WORD=NGreGetRegionBox.

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 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_INV_HRGN
  • 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      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=NGreGetRegionBox. */
LONG      rc;         /*  Return codes. */

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

Remarks

When the region is empty, the rectangle is returned with the right boundary equal to the left, and the top boundary equal to the bottom. GreGetRegionBox must return an error when the region indicated by hrgn is selected into the DC as a clip region.