WinUnionRect
Appearance
This function calculates a rectangle that bounds the two source rectangles.
Syntax
WinUnionRect(hab, prclDest, prclSrc1, prclSrc2)
Parameters
- hab (HAB) - Input
- Anchor-block handle.
- prclDest (PRECTL) - Output
- Bounding rectangle.
- Note
- The value of each field in this structure must be in the range -32 768 through 32 767. The data type WRECT may also be used, if supported by the language.
- prclSrc1 (PRECTL) - Input
- First source rectangle.
- Note
- The value of each field in this structure must be in the range -32 768 through 32 767. The data type WRECT may also be used, if supported by the language.
- prclSrc2 (PRECTL) - Input
- Second source rectangle.
- Note
- The value of each field in this structure must be in the range -32 768 through 32 767. The data type WRECT may also be used, if supported by the language.
Returns
- rc (BOOL) - returns
- Nonempty indicator.
- TRUE
- prclDest is a nonempty rectangle
- FALSE
- Error, or prclDest is an empty rectangle.
Remarks
prclSrc1 and prclSrc2 must not be NULL pointers, although the rectangles they point to can be empty (see the WinIsRectEmpty function). If one of the source rectangles is empty, the other is returned.
Errors
Possible returns from WinGetLastError: (No specific errors were listed in the provided text.)
Example Code
#define INCL_WINRECTANGLES /* Or use INCL_WIN, INCL_PM, */ #include <os2.h> HAB hab; /* Anchor-block handle. */ PRECTL prclDest; /* Bounding rectangle. */ PRECTL prclSrc1; /* First source rectangle. */ PRECTL prclSrc2; /* Second source rectangle. */ BOOL rc; /* Nonempty indicator. */ rc = WinUnionRect(hab, prclDest, prclSrc1, prclSrc2);
This example uses the WinUnionRect call to find a rectangle that bounds two source rectangles.
#define INCL_WINRECTANGLES #include <OS2.H> HAB hab; RECTL resultrcl; /* result */ RECTL rcla={25, /* x coordinate of left-hand edge of */ /* rectangle */ 25, /* y coordinate of bottom edge of */ /* rectangle */ 125, /* x coordinate of right-hand edge of */ /* rectangle */ 125}; /* y coordinate of top edge of rectangle */ RECTL rclb = {15, /* x coordinate of left-hand edge of */ /* rectangle */ 15, /* y coordinate of bottom edge of */ /* rectangle */ 125, /* x coordinate of right-hand edge of */ /* rectangle */ 125}; WinUnionRect(hab, &resultrcl, &rcla, &rclb);