Draws graphical feedback during an input process.
GSErrCode ACAPI_Interface ( APIIo_DrawRubberArcID, API_RubberArcType* rubberArc );
Parameters
- rubberArc
- [in] Definition of the arc (circle or elliptic) to be drawn.
Return Values
NoError
- The function has completed with success.
APIERR_GENERAL
- no rubber line callback function has been defined
APIERR_BADPARS
rubberArc->arcType
is neitherAPIRubberArc_OrigoAngles
norAPIRubberArc_ThreePoint
For other common API errors see the API Errors document.
Remarks
This function is used to draw rubber arcs while a user input. The function can be called only from the RubberLineInfoProc passed to the given input function; APIIo_GetPointID or APIIo_GetLineID or APIIo_GetArcID or APIIo_GetPolyID.
The arc is defined with the coordinate of the center point, the radius (or ‘a’ if ellipse), the beginning angle of the arc and the ending angle of the arc or with the coordinate of the center point, the beginning point of the arc, the ending point of the arc and the sign of the arc’s angle (see API_RubberArcType).
Example
#define PI 3.141592653589793 /*------------------------------------------------------** ** Callback function to draw the rubber lines ** **------------------------------------------------------*/ static void __ACENV_CALL RubberLineCallBack (const API_RubberLineInfo *info) { API_RubberArcType rubberArc; BNZeroMemory (&rubberArc, sizeof (API_RubberArcType)); rubberArc.lineThick = APIRubberLine_Simple; /* draws a unit circle around the actual cursor position */ rubberArc.arcType = APIRubberArc_OrigoAngles; rubberArc.arc2D.r = crossWidth; rubberArc.arc2D.angle = 0.0; rubberArc.arc2D.ratio = 1.0; rubberArc.arc2D.begAng = 0; rubberArc.arc2D.endAng = 2 * PI; rubberArc.origC = info->actCoord; ACAPI_Interface (APIIo_DrawRubberArcID, &rubberArc, nullptr); return; } /*------------------------------------------------------** ** Filtered point input with rubberline feedback ** **------------------------------------------------------*/ void PutColumnOnAHotspot (void) { GSErrCode err; API_GetPointType pointInfo; API_Element elem; BNZeroMemory (&pointInfo, sizeof (API_GetPointType)); CHCopyC ("Click onto a hotspot to create column", pointInfo.prompt); pointInfo.changeFilter = true; /* let the cursor gravitate to hotspot neigs only */ ACAPI_Interface (APIIo_InitNeigFilterID, pointInfo.filter, (void *) APIInitNeigFilter_Empty); ACAPI_Interface (APIIo_SetNeigFilterID, pointInfo.filter, (void *) APINeig_Hot); err = ACAPI_Interface (APIIo_GetPointID, &pointInfo, (void *) RubberLineCallBack); if (err) { if (err == APIERR_CANCEL) ACAPI_WriteReport ("Input was interrupted", true); else ACAPI_WriteReport ("Error in GetPoint", true); } else { if (pointInfo.neig.neigID != APINeig_Hot) { ACAPI_WriteReport ("There is no hotspot at the clicked position", true); } else { BNZeroMemory (&elem, sizeof (API_Element)); elem.header.type = API_ColumnID; err = ACAPI_Element_GetDefaults (&elem, nullptr); if (err == NoError) { elem.column.origoPos.x = pointInfo.pos.x; elem.column.origoPos.y = pointInfo.pos.y; err = ACAPI_Element_Create (&elem, nullptr); } } } return; }
Requirements
- Version: API 4.1 or later
- Header: APIdefs_Interface.h
See Also
API_RubberArcType,
APIIo_GetPointID, APIIo_GetLineID, APIIo_GetArcID, APIIo_GetPolyID,
APIIo_DrawRubberLineID, RubberLineInfoProc,
ACAPI_Interface, API Functions