Jump to content

GpiEqualRegion

From EDM2

This function checks whether two regions are identical.

Syntax

GpiEqualRegion(hps, hrgnSrc1, hrgnSrc2)

Parameters

hps (HPS) - input
Presentation-space handle.
The regions must be owned by the device identified by the currently associated device context.
hrgnSrc1 (HRGN) - input
Handle of first region.
hrgnSrc2 (HRGN) - input
Handle of second region.

Return Value

lEquality (LONG) - returns
Equality and error indicators.
EQRGN_NOTEQUAL
Not equal
EQRGN_EQUAL
Equal
EQRGN_ERROR
Error.

Remarks

Both regions must be of the same device class. It is invalid 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_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    hrgnSrc1;  /* Handle of first region. */
HRGN    hrgnSrc2;  /* Handle of second region. */
LONG    lEquality; /* Equality and error indicators. */

lEquality = GpiEqualRegion(hps, hrgnSrc1, hrgnSrc2);

This example uses GpiEqualRegion to create two regions (each consisting of three rectangles), and then compares them for equality.

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

LONG lEquality; /* equality/error indicator */
HPS hps; /* presentation-space handle */
HRGN hrgnSrc1; /* handle for first region */
HRGN hrgnSrc2; /* handle for second region */
RECTL arcl[3] = { 100, 100, 200, 200, /* 1st rectangle */
                  150, 150, 250, 250, /* 2nd rectangle */
                  200, 200, 300, 300 }; /* 3rd rectangle */

/* create two identical regions comprising three rectangles each*/
hrgnSrc1 = GpiCreateRegion(hps, 3L, arcl);
hrgnSrc2 = GpiCreateRegion(hps, 3L, arcl);

lEquality = GpiEqualRegion(hps, hrgnSrc1, hrgnSrc2);

Related Functions