Jump to content

GreSetRectRegion

From EDM2

GreSetRectRegion sets the specified region to the region definition given by an array of rectangles, unless the region is in use as a clipping region (in which case, an error is raised). When no rectangles are specified, that is, cRect is 0, GreSetRectRegion produces an empty 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

GreSetRectRegion(hdc, hrgn, parcRgn, cRect, pInstance, lFunction);

Parameters

hdc (HDC) - input
Device context handle.
hrgn (HRGN) - input
Region handle.
parcRgn (PRECTL) - input
Pointer to region definition.
The region is defined as an array of rectangles. Each rectangle in the array is defined by a RECTL structure:
  • xLeft Minimum X-coordinate of rectangle
  • yBottom Minimum Y-coordinate
  • xRight Maximum X-coordinate of rectangle
  • yTop Maximum Y-coordinate
The region is defined by the OR of all the rectangles. 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. If COM_TRANSFORM is not set, the function expects rectangles to be in device coordinates.
cRect (LONG) - input
Count of rectangles in the region definition.
pInstance (PVOID) - input
Pointer to instance data.
lFunction (ULONG) - input
High-order WORD=flags; low-order WORD=NGreSetRectRegion.

Return Code

fSuccess (BOOL) - returns
Return codes.
This function returns BOOLEAN (fSuccess).
  • TRUE Successful
  • FALSE Error.
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.


Declaration

#define INCL_GRE_REGIONS
#include <os2.h>

HDC       hdc;        /*  Device context handle. */
HRGN      hrgn;       /*  Region handle. */
PRECTL    parcRgn;    /*  Pointer to region definition. */
LONG      cRect;      /*  Count of rectangles in the region definition. */
PVOID     pInstance;  /*  Pointer to instance data. */
ULONG     lFunction;  /*  High-order WORD=flags; low-order WORD=NGreSetRectRegion. */
BOOL      fSuccess;   /*  Return codes. */

fSuccess = GreSetRectRegion(hdc, hrgn, parcRgn,
             cRect, pInstance, lFunction);