op_anim_igp_rect_fill()

Abstract

Draws a filled rectangle at the specified position within a viewer, using the specified graphical properties.

Syntax

op_anim_igp_rect_fill (anvid, props, pat_name, x, y, width, height)
Argument Type Description
anvid Anvid viewer ID
[This value is a numeric identifier which references a viewer. The rectangle 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.]
pat_name char* pattern name
[This string indicates an icon to be used as a pattern for the fill.]
x int x coordinate of rectangle upper-left corner, measured in pixels from the origin of the viewer window (upper-left corner).
y int y coordinate of rectangle upper-left corner, measured in pixels from the origin of the viewer window (upper-left corner).
width int width of rectangle, in pixels
height int height of rectangle, in pixels

Return Type

Andid

drawing ID of rectangle

[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

/** Draw the OSI 7-layer protocol stack. **/

/* Setup argument values. */
x = 100, y = 100;
w = 400, h = 50;
rfprops = OPC_ANIM_RETAIN | OPC_ANIM_COLOR_GREEN;
rdprops = OPC_ANIM_RETAIN | OPC_ANIM_COLOR_YELLOW;
tprops = OPC_ANIM_RETAIN | OPC_ANIM_COLOR_YELLOW |
	OPC_ANIM_ALIGNH_CENTER | OPC_ANIM_ALIGNV_CENTER;

/* Loop through each layer. */
for (i = 0; i < 7; i++, y += h)
	{
	op_anim_igp_rect_fill (vid, rfprops, " ", x, y, w, h);
	op_anim_igp_rect_draw (vid, rdprops, x, y, w, h);
	op_anim_igp_text_draw (vid, tprops, x + (w / 2), y + (h / 2),
		Stack_Name [i]);
	}

Details

Filled rectangle drawings are affected by the color, pixop, retain, and style graphical properties. The color graphical property of the rectangle 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 rectangle 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 rectangle drawing will later be erased). Rectangle 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 pat_name argument is only referenced if the style graphical property flag OPC_ANIM_STYLE_PATTERN is specified. A pattern fill repeatedly tiles the specified icon to fill the rectangular area. The tiles are aligned to the absolute coordinates of the graphics display device, rather than the rectangle, so moving a viewer may change the relative alignment of the rectangle and its fill tiling. You can create icons and add them to an icon database by using the Icon Database Editor. For more information, see “Icon Database Editor“ on page 615.

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.

Purpose

Provides a mechanism to draw a filled rectangle as part of an animation. The rectangle 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. Filled rectangles are useful for coloring regions within an animated diagram, for alternatively representing model objects such as nodes, modules, and states, or for diagramming abstractions such as protocol layers or packet fields.

Errors

  • Program Abort: segmentation violation (due to a badly formed string for the pat_name argument)
  • Diagnostic Error: Animation viewer ID (<anvid>) is out-of-range. (due to an invalid value for the anvid argument)
  • Diagnostic Error: Invalid property component (<prop_comp>) for graphical primitive. (due to an inapplicable or invalid value for the props argument)
  • Diagnostic Error: Kernel procedure argument (<arg_name>) has out-of-range value (<value>). (due to a value for the arguments x, y, width, or height that exceeds the range of a short integer)

Reference

本站文档由 北京智网畅联科技有限公司 整理、翻译并提供 · Documentation compiled and provided by Beijing ZNetLink Technology Co., Ltd.

交流群 · QQ Group:OPNET/智网妙算网络仿真交流群(群号 486383494)

原文档 © 2017 Riverbed Technology · 本站为公益翻译,由 AI 辅助完成,请仔细甄别

Original documentation © 2017 Riverbed Technology. Community translation, AI-assisted. Contact: jiazequn@znetlink.com