GreGetBoundsData

From EDM2
Jump to: navigation, search

GreGetBoundsData stores the bounding rectangle of previous drawing primitives at the address indicated by pBoundsData.

This function must be supported by the presentation driver. GreGetBoundsData is called by GpiQueryBoundaryData in response to an application's request for the current boundary data for a presentation space and device context pair. This function can be handled by bit-map simulation.

Syntax

GreGetBoundsData(hdc, flOptions, pBoundsData, pInstance, lFunction)

Parameters

hdc (HDC) - input 
Device context handle.
flOptions (ULONG) - input 
Option flags.
The option flags define which bounding rectangle the handling routine should return. Valid values are:
  • GBD_GPI Return GPI bounds in model space coordinates
  • GBD_USER Return current user bounds in screen coordinates and reset user bounds to their initial value
pBoundsData (PRECTL) - input 
Pointer to the address for the returned RECTL structure that defines the specified bounding rectangle.
pInstance (PVOID) - input 
Pointer to instance data.
lFunction (ULONG) - input 
High-order WORD=flags; low-order WORD=NGreGetBoundsData.

Returns

rc (BOOL) - returns 
Return Code.

On completion, the handling routine must return a BOOLEAN value to indicate success or an error.

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_DEV_FUNC_NOT_INSTALLED
PMERR_INV_HDC

Remarks

Simulation support: None. This function is mandatory for all drivers.

All presentation drivers must support GPI bounds. These bounds should be transformed to model space coordinates when they are accumulated. Display drivers must also support user bounds in screen coordinates. Bounds are inclusive. A NULL boundary is represented by the minimum coordinates of the rectangle, which are greater than its maximum coordinates. If the bounds have been reset, a NULL value is returned for pBoundsData.

Example Code

#define INCL_GRE_DEVMISC3
#include <os2.h>

HDC       hdc;          /*  Device context handle. */
ULONG     flOptions;    /*  Option flags. */
PRECTL    pBoundsData;
PVOID     pInstance;    /*  Pointer to instance data. */
ULONG     lFunction;    /*  High-order WORD=flags; low-order WORD=NGreGetBoundsData. */
BOOL      rc;           /*  Return Code. */

rc = GreGetBoundsData(hdc, flOptions, pBoundsData, pInstance, lFunction);