Jump to content

GpiOffsetRegion

From EDM2

This function moves a region.

Syntax

GpiOffsetRegion(hps, Hrgn, pptlOffset)

Parameters

hps (HPS) - input
Presentation-space handle.
The region must be owned by the device identified by the currently associated device context.
Hrgn (HRGN) - input
Handle of the region to be moved.
pptlOffset (PPOINTL) - input
Offset to be added to the region boundary.

Return Value

rc (BOOL) - returns
Success indicator.
TRUE
Successful completion
FALSE
Error occurred.

Remarks

This function moves the region to a new position. The new position is obtained by adding the value of pptlOffset to all the points that define the region boundary. An error is raised if the specified region is currently selected as the clip region (by GpiSetClipRegion).

Errors

Possible returns from WinGetLastError:

PMERR_INV_HPS (0x207F)
An invalid presentation-space handle was specified.
PMERR_PS_BUSY (0x20F4)
An attempt was made to access the presentation space from more than one thread simultaneously.
PMERR_INV_HRGN (0x2080)
An invalid region handle was specified.
PMERR_REGION_IS_CLIP_REGION (0x20F8)
An attempt was made to perform a region operation on a region that is selected as a clip region.
PMERR_INV_COORDINATE (0x205B)
An invalid coordinate value was specified.
PMERR_HRGN_BUSY (0x2034)
An internal region busy error was detected. The region was locked by one thread during an attempt to access it from another thread.

Example Code

#define INCL_GPIREGIONS /* Or use INCL_GPI, INCL_PM, */
#include <os2.h>

HPS     hps;        /* Presentation-space handle. */
HRGN    Hrgn;       /* Handle of the region to be moved. */
PPOINTL pptlOffset; /* Offset to be added to the region boundary. */
BOOL    rc;         /* Success indicator. */

rc = GpiOffsetRegion(hps, Hrgn, pptlOffset);

This example uses GpiOffsetRegion to move a region right by 3 and up by 3.

#define INCL_GPIREGIONS /* Region functions */
#include <os2.h>

BOOL fSuccess; /* success indicator */
HPS hps; /* Presentation-space handle */
HRGN Hrgn; /* handle for region */
POINTL pptlOffset = {3,3}; /* displacement */

fSuccess = GpiOffsetRegion(hps, Hrgn, &pptlOffset);

Related Functions