Jump to content

GreGetRegionRects: Difference between revisions

From EDM2
Created page with "; Simulation support: This function is simulated by a handling routine in the graphics engine. GreGetRegionRects fills the array pointed to by parclRect with a list of (X,Y..."
 
Ak120 (talk | contribs)
mNo edit summary
Line 1: Line 1:
; Simulation support: This function is simulated by a handling routine in the graphics engine.  
;Simulation support: This function is simulated by a handling routine in the graphics engine.


GreGetRegionRects fills the array pointed to by parclRect with a list of (X,Y) coordinate pairs specifying the rectangles that together define the region associated with hrgn. All rectangle coordinates are inclusive at the bottom-left corner, and exclusive at the top-right corner. Notice that the coordinates of the bounding box, and the rectangles returned, will be in device coordinates. GreGetRegionRects raises an error when hrgn is the handle of a currently selected clip region.  
GreGetRegionRects fills the array pointed to by parclRect with a list of (X,Y) coordinate pairs specifying the rectangles that together define the region associated with hrgn. All rectangle coordinates are inclusive at the bottom-left corner, and exclusive at the top-right corner. Notice that the coordinates of the bounding box, and the rectangles returned, will be in device coordinates. GreGetRegionRects raises an error when hrgn is the handle of a currently selected clip region.


This function can be hooked by the presentation driver.  
This function can be hooked by the presentation driver.


This function can be used to determine if the banding rectangle is inside, outside, or crossing the device's clip rectangle.  
This function can be used to determine if the banding rectangle is inside, outside, or crossing the device's clip rectangle.


==Syntax==
==Syntax==
  rc = GreGetRegionRects(hdc, hrgn, prclBoundRect, pControl, parclRect, pInstance, lFunction);
  GreGetRegionRects(hdc, hrgn, prclBoundRect, pControl, parclRect, pInstance, lFunction)


==Parameters==
==Parameters==
; hdc (HDC) - input  
;hdc (HDC) - input: Device context handle.
: Device context handle.  
;hrgn (HRGN) - input: Region handle.
 
;prclBoundRect (PRECTL) - input: Pointer to bounding rectangle.
; hrgn (HRGN) - input  
:RECTL structure:
: Region handle.  
:* xLeft Minimum x-coordinate of window
 
:* yBottom Minimum y-coordinate
; prclBoundRect (PRECTL) - input  
:* xRight Maximum x-coordinate of window
: Pointer to bounding rectangle.  
:* yTop Maximum y-coordinate
 
:Only rectangles intersecting this bounding rectangle are returned. If this pointer is NULL, all rectangles in the region are enumerated. If this pointer is not NULL, only rectangles that intersect the bounding rectangle are returned. Each of these rectangles is the intersection of the bounding rectangle with a rectangle in the region.
RECTL structure:  
;pControl (PRGNRECT) - input: This is a pointer to a RGNRECT structure:
 
:lrcStart The rectangle number to start enumerating (1 indicates start at the beginning).
* xLeft Minimum x-coordinate of window  
:If parclRect is NULL, this field is always 1.
* yBottom Minimum y-coordinate  
:crc The number of rectangles that can fit into the buffer (at least 1).
* xRight Maximum x-coordinate of window  
:If parclRect is NULL and the clip region is completely within prclBoundRect, crc contains the value RRGN_INSIDE.
* yTop Maximum y-coordinate  
:If parclRect is NULL and the clip region is completely outside prclBoundRect, crc contains the value RRGN_OUTSIDE.
 
:If parclRect is NULL and the clip region spans prclBoundRect, crc contains the value RRGN_PARTIAL.
Only rectangles intersecting this bounding rectangle are returned. If this pointer is NULL, all rectangles in the region are enumerated. If this pointer is not NULL, only rectangles that intersect the bounding rectangle are returned. Each of these rectangles is the intersection of the bounding rectangle with a rectangle in the region.  
:crcReturned Number of rectangles that were written into the buffer. If less than lrcStart, there are no more rectangles to enumerate.
 
:If parclRect is NULL and the clip region is completely within prclBoundRect, crcReturned contains the value 1.
; pControl (PRGNRECT) - input  
:If parclRect is NULL and the clip region is completely outside prclBoundRect, crcReturned contains the value 0.
: This is a pointer to a RGNRECT structure:  
:If parclRect is NULL and the clip region spans prclBoundRect, crcReturned contains the number of clip rectangles.
 
:usDirection The direction in which the rectangles are listed:
 
* RECTDIR_LFRT_TOPBOT Left-to-right, top-to-bottom
lrcStart The rectangle number to start enumerating (1 indicates start at the beginning).  
* RECTDIR_RTLF_TOPBOT Right-to-left, top-to-bottom
 
* RECTDIR_LFRT_BOTTOP Left-to-right, bottom-to-top
If parclRect is NULL, this field is always 1.  
* RECTDIR_RTLF_BOTTOP Right-to-left, bottom-to-top
 
:If parclRect is NULL, usDirection is not applicable.
crc The number of rectangles that can fit into the buffer (at least 1).  
;parclRect (PRECTL) - input: Pointer to array of rectangle structures that define the region.
 
;pInstance (PVOID) - input: Pointer to instance data.
If parclRect is NULL and the clip region is completely within prclBoundRect, crc contains the value RRGN_INSIDE.  
;lFunction (ULONG) - input: High-order WORD=flags; low-order WORD=NGreGetRegionRects.
 
If parclRect is NULL and the clip region is completely outside prclBoundRect, crc contains the value RRGN_OUTSIDE.  
 
If parclRect is NULL and the clip region spans prclBoundRect, crc contains the value RRGN_PARTIAL.  
 
crcReturned Number of rectangles that were written into the buffer. If less than lrcStart, there are no more rectangles to enumerate.  
 
If parclRect is NULL and the clip region is completely within prclBoundRect, crcReturned contains the value 1.  
 
If parclRect is NULL and the clip region is completely outside prclBoundRect, crcReturned contains the value 0.  
 
If parclRect is NULL and the clip region spans prclBoundRect, crcReturned contains the number of clip rectangles.  
 
usDirection The direction in which the rectangles are listed:  
 
* RECTDIR_LFRT_TOPBOT Left-to-right, top-to-bottom  
* RECTDIR_RTLF_TOPBOT Right-to-left, top-to-bottom  
* RECTDIR_LFRT_BOTTOP Left-to-right, bottom-to-top  
* RECTDIR_RTLF_BOTTOP Right-to-left, bottom-to-top  
 
If parclRect is NULL, usDirection is not applicable.  
 
; parclRect (PRECTL) - input  
: Pointer to array of rectangle structures that define the region.  
 
; pInstance (PVOID) - input  
: Pointer to instance data.  
 
; lFunction (ULONG) - input  
: High-order WORD=flags; low-order WORD=NGreGetRegionRects.  


==Return Code==
==Return Code==
; rc (BOOL) - returns  
;rc (BOOL) - returns: Return codes.
: Return codes.  
This function returns BOOLEAN (fSuccess).
 
* TRUE Successful
This function returns BOOLEAN (fSuccess).  
* 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:
* TRUE Successful  
* PMERR_HRGN_BUSY
* FALSE Error  
* PMERR_INV_COORDINATE
 
* PMERR_INV_HRGN
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_INV_RECT
 
* PMERR_INV_REGION_CONTROL
* PMERR_HRGN_BUSY  
* PMERR_REGION_IS_CLIP_REGION
* PMERR_INV_COORDINATE  
Refer to the "Error Explanations" section in the Presentation Manager Programming Reference for further explanation.
* PMERR_INV_HRGN  
* PMERR_INV_RECT  
* PMERR_INV_REGION_CONTROL  
* PMERR_REGION_IS_CLIP_REGION  
 
Refer to the "Error Explanations" section in the Presentation Manager Programming Reference for further explanation.  


==Example Code==
==Example Code==

Revision as of 22:22, 24 March 2020

Simulation support
This function is simulated by a handling routine in the graphics engine.

GreGetRegionRects fills the array pointed to by parclRect with a list of (X,Y) coordinate pairs specifying the rectangles that together define the region associated with hrgn. All rectangle coordinates are inclusive at the bottom-left corner, and exclusive at the top-right corner. Notice that the coordinates of the bounding box, and the rectangles returned, will be in device coordinates. GreGetRegionRects raises an error when hrgn is the handle of a currently selected clip region.

This function can be hooked by the presentation driver.

This function can be used to determine if the banding rectangle is inside, outside, or crossing the device's clip rectangle.

Syntax

GreGetRegionRects(hdc, hrgn, prclBoundRect, pControl, parclRect, pInstance, lFunction)

Parameters

hdc (HDC) - input
Device context handle.
hrgn (HRGN) - input
Region handle.
prclBoundRect (PRECTL) - input
Pointer to bounding rectangle.
RECTL structure:
  • xLeft Minimum x-coordinate of window
  • yBottom Minimum y-coordinate
  • xRight Maximum x-coordinate of window
  • yTop Maximum y-coordinate
Only rectangles intersecting this bounding rectangle are returned. If this pointer is NULL, all rectangles in the region are enumerated. If this pointer is not NULL, only rectangles that intersect the bounding rectangle are returned. Each of these rectangles is the intersection of the bounding rectangle with a rectangle in the region.
pControl (PRGNRECT) - input
This is a pointer to a RGNRECT structure:
lrcStart The rectangle number to start enumerating (1 indicates start at the beginning).
If parclRect is NULL, this field is always 1.
crc The number of rectangles that can fit into the buffer (at least 1).
If parclRect is NULL and the clip region is completely within prclBoundRect, crc contains the value RRGN_INSIDE.
If parclRect is NULL and the clip region is completely outside prclBoundRect, crc contains the value RRGN_OUTSIDE.
If parclRect is NULL and the clip region spans prclBoundRect, crc contains the value RRGN_PARTIAL.
crcReturned Number of rectangles that were written into the buffer. If less than lrcStart, there are no more rectangles to enumerate.
If parclRect is NULL and the clip region is completely within prclBoundRect, crcReturned contains the value 1.
If parclRect is NULL and the clip region is completely outside prclBoundRect, crcReturned contains the value 0.
If parclRect is NULL and the clip region spans prclBoundRect, crcReturned contains the number of clip rectangles.
usDirection The direction in which the rectangles are listed:
  • RECTDIR_LFRT_TOPBOT Left-to-right, top-to-bottom
  • RECTDIR_RTLF_TOPBOT Right-to-left, top-to-bottom
  • RECTDIR_LFRT_BOTTOP Left-to-right, bottom-to-top
  • RECTDIR_RTLF_BOTTOP Right-to-left, bottom-to-top
If parclRect is NULL, usDirection is not applicable.
parclRect (PRECTL) - input
Pointer to array of rectangle structures that define the region.
pInstance (PVOID) - input
Pointer to instance data.
lFunction (ULONG) - input
High-order WORD=flags; low-order WORD=NGreGetRegionRects.

Return Code

rc (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_INV_COORDINATE
  • PMERR_INV_HRGN
  • PMERR_INV_RECT
  • PMERR_INV_REGION_CONTROL
  • PMERR_REGION_IS_CLIP_REGION

Refer to the "Error Explanations" section in the Presentation Manager Programming Reference for further explanation.

Example Code

#define INCL_GRE_REGIONS
#include <os2.h>

HDC         hdc;            /*  Device context handle. */
HRGN        hrgn;           /*  Region handle. */
PRECTL      prclBoundRect;  /*  Pointer to bounding rectangle. */
PRGNRECT    pControl;       /*  This is a pointer to a RGNRECT structure: */
PRECTL      parclRect;      /*  Pointer to array of rectangle structures that define the  region. */
PVOID       pInstance;      /*  Pointer to instance data. */
ULONG       lFunction;      /*  High-order WORD=flags; low-order WORD=NGreGetRegionRects. */
BOOL        rc;             /*  Return codes. */

rc = GreGetRegionRects(hdc, hrgn, prclBoundRect, pControl, parclRect, pInstance, lFunction);