GreBoxBoundary

From EDM2
Jump to: navigation, search

GreBoxBoundary draws a rectangular box with one corner at the current (X,Y) position and the opposite corner at the specified (X,Y) position. The current (X,Y) position does not change.

This function can be hooked by the presentation driver.

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

Syntax

GreBoxBoundary(hdc, pBox, pInstance, lFunction)

Parameters

hdc (HDC) - input
Device context handle.
pBox (PPOINTL) - input
Pointer to a BOXDATA structure.
pInstance (PVOID) - input
Pointer to instance data.
lFunction (ULONG) - input
High-order WORD=flags; low-order WORD=NGreBoxBoundary.

Return Code

rc (LONG) - returns
On completion, this function returns an integer (cHits) indicating, where appropriate, whether correlation hits were detected.
GPI_OK: Successful
GPI_HITS: Successful with correlate hit (returned by display drivers when the correlate flag is ON and a hit is detected)
GPI_ERROR: 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_BASE_ERROR
  • PMERR_BITMAP_NOT_SELECTED
  • PMERR_COORDINATE_OVERFLOW
  • PMERR_DEV_FUNC_NOT_INSTALLED
  • PMERR_HDC_BUSY
  • PMERR_INV_BOX_ROUNDING_PARM
  • PMERR_INV_COLOR_DATA
  • PMERR_INV_COLOR_INDEX
  • PMERR_INV_COORD_SPACE
  • PMERR_INV_HDC
  • PMERR_INV_IN_AREA
  • PMERR_INV_IN_PATH
  • PMERR_INV_LENGTH_OR_COUNT
  • PMERR_INV_NESTED_FIGURES
  • PMERR_INV_PICK_APERTURE_POSN
  • PMERR_INV_RECT
  • PMERR_NOT_IN_PATH
  • PMERR_PATH_LIMIT_EXCEEDED
  • PMERR_PATH_UNKNOWN
Refer to the "Error Explanations" section in the Presentation Manager Programming Reference for further explanation.

Remarks

The sides of the box (before transformation) are parallel to the X-axis and the Y-axis. The corners of the box can be rounded by means of quarter ellipses of the specified diameters. When the value of either diameter is 0, no rounding occurs. When the value of either diameter exceeds the length of the corresponding side, that length is used as the diameter instead. When the value of the diameters are equal to the value of the sides, the corners are rounded with a quarter circle. If the current position is (x0, y0), the box is drawn from the current position in a counterclockwise direction.

When correlating, the handling routine records a hit when the pick aperture intersects the boundary.

Sample Code

#define INCL_GRE_ARCS
#include <os2.h>

HDC        hdc;        /*  Device context handle. */
PPOINTL    pBox;       /*  Pointer to a BOXDATA structure: */
PVOID      pInstance;  /*  Pointer to instance data. */
ULONG      lFunction;  /*  High-order WORD=flags; low-order WORD=NGreBoxBoundary. */
LONG       rc;

rc = GreBoxBoundary(hdc, pBox, pInstance, lFunction);