GpiPartialArc: Difference between revisions
Created page with "This function draws a straight line, followed by an arc. ==Syntax== GpiPartialArc(hps, pptlCenter, fxMultiplier, fxStartAngle, fxSweepAngle); ==Parameters== ;hps (HPS) - input :Presentation-space handle. ;pptlCenter (PPOINTL) - input :Center point. :Center of the arc. ;fxMultiplier (FIXED) - input :Multiplier. :This determines the size of the arc in relation to an arc with the current arc parameters. :The implementation limit for the multiplier is 255. :The value..." |
mNo edit summary |
||
Line 1: | Line 1: | ||
This function draws a straight line, followed by an arc. | This function draws a straight line, followed by an arc. | ||
==Syntax== | ==Syntax== | ||
GpiPartialArc(hps, pptlCenter, fxMultiplier, fxStartAngle, fxSweepAngle) | GpiPartialArc(hps, pptlCenter, fxMultiplier, fxStartAngle, fxSweepAngle) | ||
==Parameters== | ==Parameters== | ||
;hps (HPS) - input | ;hps (HPS) - input:Presentation-space handle. | ||
:Presentation-space handle. | ;pptlCenter (PPOINTL) - input:Center point. | ||
:Center of the arc. | |||
;pptlCenter (PPOINTL) - input | ;fxMultiplier (FIXED) - input:Multiplier. | ||
:Center point. | |||
:Center of the arc. | |||
;fxMultiplier (FIXED) - input | |||
:Multiplier. | |||
:This determines the size of the arc in relation to an arc with the current arc parameters. | :This determines the size of the arc in relation to an arc with the current arc parameters. | ||
:The implementation limit for the multiplier is 255. | :The implementation limit for the multiplier is 255. | ||
:The value must not be negative. | :The value must not be negative. | ||
;fxStartAngle (FIXED) - input:Start angle in degrees. | |||
;fxStartAngle (FIXED) - input | :The value must be positive. | ||
:Start angle in degrees. | ;fxSweepAngle (FIXED) - input:Sweep angle in degrees. | ||
:The value must be positive. | :The value must be positive. | ||
;fxSweepAngle (FIXED) - input | |||
:Sweep angle in degrees. | |||
:The value must be positive. | |||
==Returns== | ==Returns== | ||
;lHits (LONG) - returns | ;lHits (LONG) - returns:Correlation and error indicators. | ||
:Correlation and error indicators. | ::GPI_OK - Successful | ||
::GPI_HITS - Correlate hits | |||
: | ::GPI_ERROR - Error. | ||
:: | |||
: | |||
==Errors== | ==Errors== | ||
Possible returns from WinGetLastError | Possible returns from WinGetLastError | ||
;PMERR_INV_HPS (0x207F) | ;PMERR_INV_HPS (0x207F):An invalid presentation-space handle was specified. | ||
: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) | ;PMERR_INV_MULTIPLIER (0x20A7):An invalid multiplier parameter was specified with GpiPartialArc or GpiFullArc. | ||
:An attempt was made to access the presentation space from more than one thread simultaneously. | ;PMERR_INV_COORDINATE (0x205B):An invalid coordinate value was specified. | ||
;PMERR_INV_MULTIPLIER (0x20A7) | ;PMERR_INV_ANGLE_PARM (0x203F):An invalid angle parameter was specified with GpiPartialArc. | ||
:An invalid multiplier parameter was specified with GpiPartialArc or GpiFullArc. | ;PMERR_INV_NESTED_FIGURES (0x20A8):Nested figures have been detected within a path definition. | ||
;PMERR_INV_COORDINATE (0x205B) | |||
:An invalid coordinate value was specified. | |||
;PMERR_INV_ANGLE_PARM (0x203F) | |||
:An invalid angle parameter was specified with GpiPartialArc. | |||
;PMERR_INV_NESTED_FIGURES (0x20A8) | |||
:Nested figures have been detected within a path definition. | |||
==Remarks== | ==Remarks== | ||
This function draws two figures: | This function draws two figures: | ||
* A straight line, from the current position to the starting point of an arc | * A straight line, from the current position to the starting point of an arc | ||
* An arc, with its center at the specified point. | * An arc, with its center at the specified point. | ||
The full arc, of which the arc is a part, is identical to that defined by GpiFullArc. The part of the arc drawn by this primitive is defined by the parameters fxStartAngle and fxSweepAngle, that are the start and sweep angles, subtended from the center, if the current arc parameters specify a circular form. If they do not, these angles are skewed to the same degree that the ellipse is a skewed circle. fxStartAngle is measured counterclockwise from the x axis of the circle before application of the arc parameters. Both angles must be positive; whether the arc is drawn clockwise or counterclockwise is determined by the arc parameters. | The full arc, of which the arc is a part, is identical to that defined by GpiFullArc. The part of the arc drawn by this primitive is defined by the parameters fxStartAngle and fxSweepAngle, that are the start and sweep angles, subtended from the center, if the current arc parameters specify a circular form. If they do not, these angles are skewed to the same degree that the ellipse is a skewed circle. fxStartAngle is measured counterclockwise from the x axis of the circle before application of the arc parameters. Both angles must be positive; whether the arc is drawn clockwise or counterclockwise is determined by the arc parameters. | ||
Line 65: | Line 45: | ||
A segment of a pie can be drawn by the following calling sequence: | A segment of a pie can be drawn by the following calling sequence: | ||
GpiMove, to center of pie 2. | GpiMove, to center of pie 2. | ||
GpiPartialArc, drawing one spoke and the arc 3. | GpiPartialArc, drawing one spoke and the arc 3. | ||
GpiLine, back to center. | GpiLine, back to center. | ||
The third step can be performed implicitly by autoclosure if an area is being drawn. | The third step can be performed implicitly by autoclosure if an area is being drawn. | ||
A closed figure bounded by a chord and an arc can be drawn by the following calling sequence: | A closed figure bounded by a chord and an arc can be drawn by the following calling sequence: | ||
GpiSetLineType to invisible 2. | GpiSetLineType to invisible 2. | ||
GpiPartialArc, with fxStartAngle = angle2, and fxSweepAngle = 0, to define one end of the chord 3. | GpiPartialArc, with fxStartAngle = angle2, and fxSweepAngle = 0, to define one end of the chord 3. | ||
Line 84: | Line 61: | ||
==Example Code== | ==Example Code== | ||
This example uses the GpiPartialArc function to draw a chord (an arc whose end points are connected by a straight line). | This example uses the GpiPartialArc function to draw a chord (an arc whose end points are connected by a straight line). | ||
<pre> | <pre> | ||
#define INCL_GPIPRIMITIVES | #define INCL_GPIPRIMITIVES /* GPI primitive functions */ | ||
#include <os2.h> | #include <os2.h> | ||
HPS hps; | HPS hps; /* presentation space handle */ | ||
POINTL ptl = { 100, 100 }; /* center point for arc */ | POINTL ptl = { 100, 100 }; /* center point for arc */ | ||
GpiSetLineType(hps, LINETYPE_INVISIBLE); | |||
GpiPartialArc(hps, &ptl, MAKEFIXED(50, 0), MAKEFIXED(0, 0), MAKEFIXED(180, 0)); | |||
GpiSetLineType(hps, LINETYPE_SOLID); | |||
GpiPartialArc(hps, &ptl, MAKEFIXED(50, 0), MAKEFIXED(0, 0), MAKEFIXED(180, 0)); | |||
</pre> | </pre> | ||
==Related Functions== | ==Related Functions== | ||
Line 133: | Line 93: | ||
* GpiSetLineWidthGeom | * GpiSetLineWidthGeom | ||
* GpiSetMix | * GpiSetMix | ||
==Graphic Elements and Orders== | ==Graphic Elements and Orders== |
Latest revision as of 13:09, 3 April 2025
This function draws a straight line, followed by an arc.
Syntax
GpiPartialArc(hps, pptlCenter, fxMultiplier, fxStartAngle, fxSweepAngle)
Parameters
- hps (HPS) - input
- Presentation-space handle.
- pptlCenter (PPOINTL) - input
- Center point.
- Center of the arc.
- fxMultiplier (FIXED) - input
- Multiplier.
- This determines the size of the arc in relation to an arc with the current arc parameters.
- The implementation limit for the multiplier is 255.
- The value must not be negative.
- fxStartAngle (FIXED) - input
- Start angle in degrees.
- The value must be positive.
- fxSweepAngle (FIXED) - input
- Sweep angle in degrees.
- The value must be positive.
Returns
- lHits (LONG) - returns
- Correlation and error indicators.
- GPI_OK - Successful
- GPI_HITS - Correlate hits
- GPI_ERROR - Error.
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_INV_MULTIPLIER (0x20A7)
- An invalid multiplier parameter was specified with GpiPartialArc or GpiFullArc.
- PMERR_INV_COORDINATE (0x205B)
- An invalid coordinate value was specified.
- PMERR_INV_ANGLE_PARM (0x203F)
- An invalid angle parameter was specified with GpiPartialArc.
- PMERR_INV_NESTED_FIGURES (0x20A8)
- Nested figures have been detected within a path definition.
Remarks
This function draws two figures:
- A straight line, from the current position to the starting point of an arc
- An arc, with its center at the specified point.
The full arc, of which the arc is a part, is identical to that defined by GpiFullArc. The part of the arc drawn by this primitive is defined by the parameters fxStartAngle and fxSweepAngle, that are the start and sweep angles, subtended from the center, if the current arc parameters specify a circular form. If they do not, these angles are skewed to the same degree that the ellipse is a skewed circle. fxStartAngle is measured counterclockwise from the x axis of the circle before application of the arc parameters. Both angles must be positive; whether the arc is drawn clockwise or counterclockwise is determined by the arc parameters.
Current position is updated to the final point on the arc.
Note: This differs from GpiFullArc, where current position remains at the center of the figure. A primitive (such as GpiLine) following GpiPartialArc draws from the end point of the arc.
A segment of a pie can be drawn by the following calling sequence:
GpiMove, to center of pie 2. GpiPartialArc, drawing one spoke and the arc 3. GpiLine, back to center.
The third step can be performed implicitly by autoclosure if an area is being drawn.
A closed figure bounded by a chord and an arc can be drawn by the following calling sequence:
GpiSetLineType to invisible 2. GpiPartialArc, with fxStartAngle = angle2, and fxSweepAngle = 0, to define one end of the chord 3. GpiSetLineType to visible 4. GpiPartialArc, with fxStartAngle = angle1, and fxSweepAngle = angle2-angle1.
In the second example, angle2 is greater than angle1. If the interior of the chord is to be shaded, the area must start after step 2 or 3.)
A sweep angle of greater than 360 degrees is valid, and means that after the initial line a full arc is drawn, followed by a partial arc with a sweep angle of (fxSweepAngle MOD 360) degrees.
Example Code
This example uses the GpiPartialArc function to draw a chord (an arc whose end points are connected by a straight line).
#define INCL_GPIPRIMITIVES /* GPI primitive functions */ #include <os2.h> HPS hps; /* presentation space handle */ POINTL ptl = { 100, 100 }; /* center point for arc */ GpiSetLineType(hps, LINETYPE_INVISIBLE); GpiPartialArc(hps, &ptl, MAKEFIXED(50, 0), MAKEFIXED(0, 0), MAKEFIXED(180, 0)); GpiSetLineType(hps, LINETYPE_SOLID); GpiPartialArc(hps, &ptl, MAKEFIXED(50, 0), MAKEFIXED(0, 0), MAKEFIXED(180, 0));
Related Functions
- GpiFullArc
- GpiPointArc
- GpiPop
- GpiSetAttrMode
- GpiSetArcParams
- GpiSetAttrs
- GpiSetBackColor
- GpiSetBackMix
- GpiSetColor
- GpiSetDefArcParams
- GpiSetDefAttrs
- GpiSetLineEnd
- GpiSetLineJoin
- GpiSetLineType
- GpiSetLineWidth
- GpiSetLineWidthGeom
- GpiSetMix
Graphic Elements and Orders
Element Type: OCODE_GCPARC
Order: Partial Arc at Current Position