op_anim_igp_circle_draw()
Abstract
Draws a circle outline at the specified position within a viewer, using the specified graphical properties.
Syntax
op_anim_igp_circle_draw (anvid, props, ctr_x, ctr_y, radius)
| Argument | Type | Description |
|---|---|---|
anvid |
Anvid |
viewer ID [This value is a numeric identifier which references a viewer. The circle will be displayed in the viewer’s window.] |
props |
int |
graphical property flags [This value is the bitwise OR combination of the Animation Graphical Properties flags OPC_ANIM_COLOR_*, OPC_ANIM_PIXOP_*, OPC_ANIM_BGCOLOR_*, OPC_ANIM_STYLE_*, OPC_ANIM_ALIGNH_*, OPC_ANIM_ALIGNV_*, OPC_ANIM_FONT_*, and OPC_ANIM_RETAIN. For more information, see “Animation“ on page 3.] |
ctr_x |
int |
x coordinate of the circle’s center point, measured in pixels from the origin of the viewer window (upper-left corner) |
ctr_y |
int |
y coordinate of the circle’s center point, measured in pixels from the origin of the viewer window (upper-left corner) |
radius |
int |
radius of the circle (in pixels) |
Return Type
Andid
drawing ID of circle
[Retained drawings are issued IDs so they can later be erased (see Reference section). For a drawing to be retained, the graphical property flag OPC_ANIM_RETAIN must be passed. Non-retained drawings are issued the ID constant OPC_ANIM_ID_NIL.]
Example
/** Determine protocol state and draw new bubble in growing history diagram. */
switch (state)
{
case ST_QUIESCENT: sprintf (st_name, "Quiescent(%d)", st_num++); break;
case ST_LISTENING: sprintf (st_name, "Listening(%d)", st_num++); break;
case ST_INACTIVE: sprintf (st_name, "Inactive(%d)", st_num++); break;
case ST_ACTIVE: sprintf (st_name, "Active(%d)", st_num++); break;
}
/* Calculate new bubble position. */
old_xpos = xpos, old_ypos = ypos;
xpos = (st_num % 30) * 50; ypos = (st_num / 30) * 100;
/* Draw state bubble circle & text. */
op_anim_igp_circle_draw (vid, OPC_ANIM_RETAIN | OPC_ANIM_COLOR_YELLOW,
xpos, ypos, 20);
op_anim_igp_text_draw (vid, OPC_ANIM_RETAIN | OPC_ANIM_COLOR_YELLOW |
OPC_ANIM_FONT_OPEN_10 | OPC_ANIM_ALIGNH_CENTER, xpos, ypos + 35, st_name);
/* Connect new bubble to last bubble with line (naive diagonals). */
op_anim_igp_line_draw (vid, OPC_ANIM_RETAIN | OPC_ANIM_COLOR_YELLOW,
old_xpos + 20, old_ypos, xpos - 20, ypos);
Details
Circle drawings are affected by the color, pixop, and retain graphical properties. The color graphical property of the circle can be assigned any of the 64 indexed color values (with the format OPC_ANIM_COLOR_RGB<rgb>) or the 25 named color values (the default color is black). If the pixop graphical property is set to a value other than the default (OPC_ANIM_PIXOP_SRC), portions of the circle which are drawn over non-black viewer pixels may be displayed in a color other than that assigned (note that the pixop value OPC_ANIM_PIXOP_XOR should be used when the circle drawing will later be erased). Circle drawings with the retain graphical property set (OPC_ANIM_RETAIN) will be redrawn whenever the associated viewer window is redrawn; by default, they will simply disappear.
The special value identified by the symbolic constant OPC_ANIM_ID_NIL is returned by this KP if the retain graphical property is not enabled, or if KP execution is disabled due to the lack of a custom animation probe, or the presence of a custom animation probe which is not currently active.
In addition to the sources of viewer IDs listed in the Reference section below, the symbolic constant OPC_ANIM_ANVID_PBSPEC can be used as a substitute viewer ID, indicating that the real viewer ID should be obtained from an active unlabeled custom animation probe.
Purpose
Provides a mechanism to draw a circle as part of an animation. The circle can serve as a component in a completely customized display, or it can be added to a model diagram as an indicator of some dynamic event or status. Unfilled circles are useful for depicting a modified status of model objects; for instance, drawing a red circle around a node or module can indicate a special mode or condition. However, these applications are best performed by drawing a circle within a macro via the KP op_anim_mgp_circle_draw(), since the position of model objects can be directly obtained in a macro via the KP op_anim_mme_nobj_pos(). Model-independent animations such as state history maps or dynamic Petri nets can take advantage of Igp circles.
Errors
- Diagnostic Error: Animation viewer ID (
<anvid>) is out-of-range. (due to an invalid value for theanvidargument) - Diagnostic Error: Invalid property component (
<prop_comp>) for graphical primitive. (due to an inapplicable or invalid value for thepropsargument) - Diagnostic Error: Kernel procedure argument (
<arg_name>) has out-of-range value (<value>). (due to a value for the argumentsctr_x,ctr_y, orradiusthat exceeds the range of a short integer)
Reference
- Use the KP op_anim_igp_circle_fill() to fill a circle with a solid color or icon-derived pattern
- Use the KP op_anim_mgp_circle_draw() to draw a circle within the context of a macro
- Use the KP op_anim_igp_drawing_erase() to erase and deallocate a retained circle created by this KP
- Use the KPs op_anim_viewer_open() or op_anim_viewer_open_std() to obtain the ID of a newly created animation viewer (or rendezvous with a previously opened viewer), or the KP op_anim_lprobe_anvid() to obtain the ID of a viewer opened by a labeled custom animation probe