GrePolyFilletSharp

From EDM2
Jump to: navigation, search

GrePolyFilletSharp draws a sequence of one or more sharp fillets starting at the current (X,Y) position.

This function can be hooked by the presentation driver.

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

Syntax

GrePolyFilletSharp(hdc, paptlPoint, cPoints, pfxSharp, pInstance, lFunction)

Parameters

hdc (HDC) - input
Device context handle.
paptlPoint (PPOINTL) - input
Pointer to Coordinates array.
An array of cPoints (X,Y) pairs where each group contains two pairs of (X,Y) coordinates for the control and end points of the fillets. If COM_TRANSFORM is not set, the function expects the points to be in screen coordinates.
cPoints (LONG) - input
Number of coordinate pairs.
When this is passed as 0, it returns Successful.
pfxSharp (PFIXED) - input
Pointer to Sharpness array.
An array of sharpness values with one element for each fillet. "Sharpness" is defined as a fixed-point value. The high-order WORD contains the integer portion; the low-order WORD contains the fractional portion. A value of 64KB gives a sharpness of 1.
pInstance (PVOID) - input
Pointer to instance data.
lFunction (ULONG) - input
High-order WORD=flags; low-order WORD=NGrePolyFilletSharp.

Returns

rc (LONG) - returns
Return codes.
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_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_PICK_APERTURE_POSN
  • PMERR_INV_RECT
  • PMERR_PATH_LIMIT_EXCEEDED
  • PMERR_PATH_UNKNOWN
Refer to the "Error Explanations" section in the Presentation Manager Programming Reference for further explanation.

Sample

#define INCL_GRE_ARCS
#include <os2.h>

HDC        hdc;         /*  Device context handle. */
PPOINTL    paptlPoint;  /*  Pointer to Coordinates array. */
LONG       cPoints;     /*  Number of coordinate pairs. */
PFIXED     pfxSharp;    /*  Pointer to Sharpness array. */
PVOID      pInstance;   /*  Pointer to instance data. */
ULONG      lFunction;   /*  High-order WORD=flags; low-order WORD=NGrePolyFilletSharp. */
LONG       rc;          /*  Return codes. */

rc = GrePolyFilletSharp(hdc, paptlPoint, cPoints, pfxSharp, pInstance, lFunction);

Remarks

As each fillet is drawn, the end point for the fillet becomes the start point for the next fillet. Upon completion, the current (X,Y) position is the end point of the last fillet. Each fillet is controlled by a set of coordinates for two connected lines and by a sharpness value. The fillet is tangential to the start point of the first line and to the end point of the second line.

The sharpness value is determined from:

Sharpness = WD/DB
where:
      W is the mid-point of the line joining the end points
      B is the control point above the top of the fillet
      D is the point where the fillet intersects the line WC

Refer to the function GpiPolyFillet in the Presentation Manager Programming Reference for more information.