op_anim_mgp_circle_draw()
Abstract
Adds a primitive to the specified macro that draws a circle.
Syntax
op_anim_mgp_circle_draw (anmid, props, ctr_x, ctr_y, radius)
| Argument | Type | Description |
|---|---|---|
anmid |
Anmid |
macro ID [This value is a numeric identifier which references an open animation macro, created via the KP op_anim_macro_create().] |
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 [This value is a distance measured in pixels.] |
Return Type
void
no return value
Example
/** Construct a macro which depicts a blown-up state. **/
mid = op_anim_macro_create ("mega-state");
/* Fill the state’s circle centered at (X,Y). */
op_anim_mgp_circle_fill (mid, OPC_ANIM_COLOR_RED, " ",
OPC_ANIM_REG_X_INT, OPC_ANIM_REG_Y_INT, 200);
/* Draw the state’s inner ridge centered at (X,Y). */
op_anim_mgp_circle_draw (mid, OPC_ANIM_COLOR_BLACK,
OPC_ANIM_REG_X_INT, OPC_ANIM_REG_Y_INT, 200);
/* Fill the state’s label box at (M,N) (centered at (X,Y)). */
op_anim_mgp_reg_set (mid, OPC_ANIM_REG_W_INT, (180 / 2));
op_anim_mgp_arop (mid, OPC_ANIM_REG_X_INT, OPC_ANIM_AROP_SUBTRACT,
OPC_ANIM_REG_W_INT, OPC_ANIM_REG_M_INT);
op_anim_mgp_reg_set (mid, OPC_ANIM_REG_H_INT, (40 / 2));
op_anim_mgp_arop (mid, OPC_ANIM_REG_Y_INT, OPC_ANIM_AROP_SUBTRACT,
OPC_ANIM_REG_H_INT, OPC_ANIM_REG_N_INT);
op_anim_mgp_rect_fill (mid, OPC_ANIM_COLOR_BLACK, OPC_ANIM_REG_M_INT,
OPC_ANIM_REG_N_INT, 180, 40);
/* ... */
Details
The props, ctr_x, ctr_y, and radius arguments of this KP will accept macro register ID symbolic constants, as listed under “Animation Macro Register Identifier Symbolic Constants—Integer Values“ on page 8. If register IDs are supplied for these arguments, the actual values are taken from the specified registers at the time of macro invocation.
Circle drawings are affected by the color and pixop 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 if the specified macro will be invoked with the retain property for later erasure).
Purpose
Provides a mechanism to draw a circle in the context of a macro. 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. Such applications can be performed by loading the position of a model object into macro registers via the KP op_anim_mme_nobj_pos().
Errors
- Recoverable Error: Animation macro ID (
<anmid>) is [out-of-range] [unrecognized]. (former case due toanmidargument value that is invalid, latter case to destroyed macro) - Diagnostic Error: Invalid property component (
<prop_comp>) for graphical primitive. (due to an inapplicable or invalid literal value for thepropsargument) - Diagnostic Error: Kernel procedure argument (
<arg>) has out-of-range value (<val>). (due to a literal value for the argumentsctr_x,ctr_y, orradiusthat exceeds the range of a short)
Reference
- Use the KP op_anim_mgp_circle_fill() to fill a circle (with a solid color or icon-derived pattern) within a macro
- Use the KP op_anim_igp_circle_draw() to draw a circle in immediate mode
- Use the KP op_anim_macro_create() to create an empty macro
- Use the KP op_anim_macro_close() to indicate the completion of a macro definition
- Use the KP op_anim_igp_macro_draw() to invoke a macro within a viewer