Fixed-Size Model Icons

Keep the visual reference consistent.

Explore fixed-size icon behavior in simulation displays. Review setup and limitations before configuring icons.

Simulation Model Icon Animations

For Fixed Sized Images
Non Re-Sizable Images

perlredblink perlredblink2 perlyellowblink perlgreenblink perlorangeblink perlpurpleblink


The routines described here, map to the screen pixel-for-pixel. Zooming or changing the window size does not resize the images. For resizable images, see Resizable Images.

Instead of animating graphical simulations by simply highlighting the rectangular boxes with colors, you can replace the boxes with arbitrary drawings, -or actual images-, of meaningful objects.

You can do this with the following built-in routines:

  • read_ppm_image - Reads an image into an image data structure.
  • display_image - Replaces a named box on your diagram with an image. You use it similar to the highlight_box() function.

tmov sun

You can graphically show your components in various states by preloading images depicting each state into different image variables at start-up. Then change the component's image according to it's state.

The following is a detailed description of the image-display routines:

  • int *read_ppm_image( char *fname ) - This routine accepts the name of a file containing an image in PPM format. PPM is a convenient ascii-text file format for images. GIF and JPG images can be converted to PPM via widely available utilities such as: XV, The Gimp,
    cjpeg,
    netpbm, ..., etc..

The routine returns a pointer to the image. Use as, for example:

``` int *image_ptr;

image_ptr = read_ppm_image( "imagefile.ppm" );

```

(A related alternative routine is, read_bim_image, which reads more compact binary-format images. This routine is intended for use with the iconv image-convertor. The iconv utility converts ppm image files into a binary format.) - void display_image( char *obj_name,
              int *image_data,
              float xoffset, float yoffset

                    )
  • This routine accepts an object-name in your diagram, and a pointer to an image, and it displays the image at that object location; usually on-top of the object's box, assuming the image is large enough to cover the box. Remember that images are displayed as pixels. Their size does not change, even though box's sizes change their apparent size by the zoom-amount.

The xoffset, and yoffset parameters enable you to specify a screen location for the animation to appear relative to the named box. You can place animations adjacent to a box, or to effectively move the box's symbol around the screen. Normally, you would use a (0.0, 0.0) offset, which places the image's top-left corner at the top-left corner of the box. Positive offsets will move the image down or to the right, respectively.

Example:

``` display_image( "/platoon1/radio8", image_ptr, 0.0, 0.0 );

```

Note that you can create your own images from live data, perhaps to show algorithmic results, or for other reasons. A full example of this is in demo_exmple/demo2.


Note - The routines above will not resize the images based on zoom level. I.E. One pixel of original image - equals - one pixel on display image. Also, they will be erased whenever a screen redraw occurs, such as during a zoom, pan, or navigation operation.
See also Resizable Images for resizable and persistent image routines.


box-rotate

ret

This page is an editorial rewrite of source documentation. Historical status, availability, and platform notes are not independently verified for a current release. Technical examples are reference material, not a live simulator.