Difference between revisions of "GrePartialArc"

From EDM2
Jump to: navigation, search
(Created page with "GrePartialArc draws a straight line from the current position to the starting point of a partial arc and draws the specified partial arc. This function can be hooked by the ...")
(No difference)

Revision as of 03:05, 16 January 2020

GrePartialArc draws a straight line from the current position to the starting point of a partial arc and draws the specified partial arc.

This function can be hooked by the presentation driver.

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

Syntax

GrePartialArc(hdc, pptlCenter, fxMultiplier, fxStart, fxSweep, pInstance, lFunction); 

Parameters

hdc (HDC) - input
Device context handle.
pptlCenter (PPOINTL) - input
Pointer to (X,Y) coordinates for center of arc.
If COM_TRANSFORM is not set, the function expects the center of the arc position to be in screen coordinates.
fxMultiplier (FIXED) - input
Multiplier.
This parameter defines the size of the full arc in relation to an arc drawn with the current arc parameters. The multiplier is 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 multiplier of 1. There is an implementation limit of 255 for this value, which must not be negative.
fxStart (FIXED) - input
Start angle.
Start angle that defines the starting point on the curve. Start and sweep angles are measured counterclockwise from the X-axis at the center of the arc before the arc parameters are applied. If the current arc parameters do not specify a circle, the angles are skewed to the same degree that the full arc is a skewed circle.
The angles are specified as doubleword values in fixed-point format. The high-order WORD contains the integer portion; the low-order WORD contains the fractional portion. A value of 6553 gives an angle of 1°. Both angles must be positive. Whether the arc is drawn in a clockwise or counterclockwise direction is determined by the arc parameters. An angle greater than 360° is also valid. In this case, after the initial line, a full arc is drawn followed by a partial arc of (lSweep MOD 360)°. See also the function "GpiPartialArc" in the Presentation Manager Programming Reference.
fxSweep (FIXED) - input
Sweep angle.
Sweep angle that defines the extent of the curve to be drawn. Start and sweep angles are measured counterclockwise from the X-axis at the center of the arc before the arc parameters are applied. If the current arc parameters do not specify a circle, the angles are skewed to the same degree that the full arc is a skewed circle.
The angles are specified as doubleword values in fixed-point format. The high-order WORD contains the integer portion; the low-order WORD contains the fractional portion. A value of 6553 gives an angle of 1°. Both angles must be positive. Whether the arc is drawn in a clockwise or counterclockwise direction is determined by the arc parameters. An angle greater than 360° is also valid. In this case, after the initial line, a full arc is drawn followed by a partial arc of (lSweep MOD 360)°. See also the function "GpiPartialArc" in the Presentation Manager Programming Reference.
pInstance (PVOID) - input
Pointer to instance data.
lFunction (ULONG) - input
High-order WORD=flags; low-order WORD=NGrePartialArc.

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_ANGLE_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_MULTIPLIER
  • 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    pptlCenter;    /*  Pointer to (X,Y) coordinates for center of arc. */
FIXED      fxMultiplier;  /*  Multiplier. */
FIXED      fxStart;       /*  Start angle. */
FIXED      fxSweep;       /*  Sweep angle. */
PVOID      pInstance;     /*  Pointer to instance data. */
ULONG      lFunction;     /*  High-order WORD=flags; low-order WORD=NGrePartialArc. */
LONG       rc;            /*  Return codes. */

rc = GrePartialArc(hdc, pptlCenter, fxMultiplier,
       fxStart, fxSweep, pInstance, lFunction);

Remarks

Upon completion, the current (X,Y) position is the end of the partial arc. The dimensions of the full arc are defined as a multiplier, which is applied to the current arc parameters. The partial arc that is drawn is the section of the full arc that is enclosed by the specified start and sweep angles.

If GrePartialArc is used within a path or an area definition to continue a figure following a GreBoxxxx or GreFullArcxxx function, the error PMERR_INV_NESTED_FIGURES is posted. This error occurs because GreBoxxxx and GreFullArcxxx generate a closed figure within an area or path definition.