Jump to content

GpiQueryBoundaryData: Difference between revisions

From EDM2
Ak120 (talk | contribs)
mNo edit summary
Ak120 (talk | contribs)
mNo edit summary
Line 1: Line 1:
This function returns the boundary data.  
This function returns the boundary data.


==Syntax==
==Syntax==
  rc = GpiQueryBoundaryData(hps, prclBoundary);
  GpiQueryBoundaryData(hps, prclBoundary)


==Parameters==
==Parameters==
Line 10: Line 10:
==Return Code==
==Return Code==
;rc (BOOL) - returns : Success indicator.
;rc (BOOL) - returns : Success indicator.
  TRUE       Successful completion  
  TRUE   Successful completion  
  FALSE       Error occurred.
  FALSE Error occurred.


===Errors===
===Errors===
Possible returns from WinGetLastError
Possible returns from [[WinGetLastError]]
; PMERR_INV_HPS (0x207F) : An invalid presentation-space handle was specified.  
; 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_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_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.
; 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.



Revision as of 14:35, 7 September 2017

This function returns the boundary data.

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