GpiQueryBoundaryData
From EDM2
This function returns the boundary data.
Contents
Syntax
GpiQueryBoundaryData(hps, prclBoundary)
Parameters
- hps (HPS) - input
- Presentation-space handle.
- prclBoundary (PRECTL) - output
- Pointer to a rectangle structure in which the boundary data is returned.
Return Code
- rc (BOOL) - returns
- Success indicator.
TRUE Successful completion FALSE Error occurred.
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_COORDINATE_OVERFLOW (0x2014)
- An internal coordinate overflow error occurred. This can occur if coordinates or matrix transformation elements (or both) are invalid or too large.
- PMERR_INV_DC_TYPE (0x2060)
- An invalid type parameter was specified with DevOpenDC, or a function was issued that is invalid for a OD_METAFILE_NOQUERY device context.
Remarks
This function returns the boundary data set upon completion of the last boundary calculation. Boundary data is returned as the coordinates in model space.
Boundary data is inclusive. A null boundary is indicated if xLeft is greater than xRight, or if yBottom is greater than yTop. After GpiResetBoundaryData, xLeft and yBottom are the maximum positive numbers, and xRight and yTop are the maximum negative numbers.
Example Code
This example uses the GpiQueryBoundaryData function to retrieve the rectangle enclosing the output. The boundary data is then used to draw a border around the output.
#define INCL_GPICORRELATION #define INCL_GPIPRIMITIVES /* GPI primitive functions */ #define INCL_GPICONTROL /* GPI control Functions */ #include <os2.h> HPS hps; /* presentation space handle */ POINTL ptlStart = { 0, 0 }; /* first vertex */ POINTL ptlTriangle[] = { 100, 100, 200, 0, 0, 0 }; /* vertices */ RECTL rcl; /* rectangle */ GpiSetDrawControl(hps, DCTL_BOUNDARY, DCTL_ON); /* accumulate boundary data */ GpiMove(hps, &ptlStart); /* produce output */ GpiPolyLine(hps, 3L, ptlTriangle); GpiQueryBoundaryData(hps, &rcl); /* copy boundary data to rcl */ if (rcl.xLeft < rcl.xRight) { /* verify output exists*/ ptlStart.x = rcl.xLeft; ptlStart.y = rcl.yBottom; GpiMove(hps, &ptlStart); /* move to lower-right corner */ ptlStart.x = rcl.xRight; ptlStart.y = rcl.yTop; GpiBox(hps, DRO_OUTLINE, &ptlStart, 0L, 0L); /* draw border */ }
Related Functions
- GpiResetBoundaryData
- GpiSetDrawControl