Jump to content

GpiRectInRegion: Difference between revisions

From EDM2
Created page with "This function checks whether any part of a rectangle lies within the specified region. ==Syntax== GpiRectInRegion(hps, hrgn, prclRect) ==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 : Region handle. ; prclRect (PRECTL) - input : Test rectangle. : The rectangle is specified in device coordinates. ==Return Value== ; lInsid..."
 
Ak120 (talk | contribs)
mNo edit summary
 
Line 5: Line 5:


==Parameters==
==Parameters==
; hps ([[HPS]]) - input
; hps ([[HPS]]) - input: Presentation-space handle.
: Presentation-space handle.
: The region must be owned by the device identified by the currently associated device context.
: The region must be owned by the device identified by the currently associated device context.
 
; hrgn ([[HRGN]]) - input: Region handle.
; hrgn ([[HRGN]]) - input
; prclRect ([[PRECTL]]) - input: Test rectangle.
: Region handle.
 
; prclRect ([[PRECTL]]) - input
: Test rectangle.
: The rectangle is specified in device coordinates.
: The rectangle is specified in device coordinates.


==Return Value==
==Return Value==
; lInside ([[LONG]]) - returns
; lInside ([[LONG]]) - returns: Inside and error indicators.
: Inside and error indicators.
:: RRGN_OUTSIDE - Not in region
:; RRGN_OUTSIDE
:: RRGN_PARTIAL - Some in region
:: Not in region
:: RRGN_INSIDE - All in region
:; RRGN_PARTIAL
:: RRGN_ERROR - Error.
:: Some in region
:; RRGN_INSIDE
:: All in region
:; RRGN_ERROR
:: Error.


==Remarks==
==Remarks==
Line 33: Line 23:
==Errors==
==Errors==
Possible returns from WinGetLastError:
Possible returns from WinGetLastError:
; PMERR_INV_HPS (0x207F)
; PMERR_INV_HPS (0x207F): An invalid presentation-space handle was specified.
: 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_PS_BUSY (0x20F4)
; PMERR_INV_HRGN (0x2080): An invalid region handle was specified.
: An attempt was made to access the presentation space from more than one thread simultaneously.
; PMERR_INV_COORDINATE (0x205B): An invalid coordinate value was specified.
; PMERR_INV_HRGN (0x2080)
; PMERR_INV_RECT (0x20BD): An invalid rectangle parameter was specified.
: 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)
; 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.
: An invalid coordinate value was specified.
; PMERR_INV_RECT (0x20BD)
: An invalid rectangle parameter 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==
==Example Code==
<PRE>
#define INCL_GPIREGIONS /* Or use INCL_GPI, INCL_PM, */
#include &lt;os2.h&gt;
HPS    hps;        /* Presentation-space handle. */
HRGN    hrgn;      /* Region handle. */
PRECTL  prclRect;  /* Test rectangle. */
LONG    lInside;    /* Inside and error indicators. */
lInside = GpiRectInRegion(hps, hrgn, prclRect);
</PRE>
In this example we check to see if a a rectangle is inside a region before we destroy the region.
In this example we check to see if a a rectangle is inside a region before we destroy the region.
<pre>
<pre>
#define INCL_GPIREGIONS
#define INCL_GPIREGIONS
#include &lt;OS2.H&gt;
#include <OS2.H>


HPS hps; /* presentation-space handle. */
HPS hps; /* presentation-space handle. */

Latest revision as of 01:34, 17 November 2025

This function checks whether any part of a rectangle lies within the specified region.

Syntax

GpiRectInRegion(hps, hrgn, prclRect)

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
Region handle.
prclRect (PRECTL) - input
Test rectangle.
The rectangle is specified in device coordinates.

Return Value

lInside (LONG) - returns
Inside and error indicators.
RRGN_OUTSIDE - Not in region
RRGN_PARTIAL - Some in region
RRGN_INSIDE - All in region
RRGN_ERROR - Error.

Remarks

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_INV_COORDINATE (0x205B)
An invalid coordinate value was specified.
PMERR_INV_RECT (0x20BD)
An invalid rectangle parameter 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

In this example we check to see if a a rectangle is inside a region before we destroy the region.

#define INCL_GPIREGIONS
#include <OS2.H>

HPS hps; /* presentation-space handle. */
HRGN hrgn; /* region handle. */
PRECTL prclRect; /* test rectangle. */
LONG lInside; /* result. */

lInside = GpiRectInRegion(hps, hrgn, prclRect);

if (lInside == RRGN_OUTSIDE)
{
  GpiDestroyRegion(hps, hrgn);
}

Related Functions