Enter a ZIP code to get a forecast:
Setup Location

WRN Logo

WXP Loop

The wxploop program is an interactive program that allows WXP programs to overlay and animate.  This program sets up a bitmap (or pixmap) which can be used as a canvas for several WXP programs.  A bitmap/pixmap is a reserved area of memory that mimics the display window so that graphics can be drawn to it just as if it were to the window.  Multiple programs can all draw to the same bitmap allowing products to be overlaid.  Second, the program can open up several bitmaps, each acting as a separate canvas and the resulting bitmaps can be looped to show animation.

wxploop.gif (3292 bytes)

Information can be drawn onto the window or a pixmap in one of three ways:

  1. using the annotation features of wxploop to draw lines, text and filled areas,
  2. using the window or pixmap ID to allow another program to draw directly to that window or pixmap,
  3. importing an image (XWD,GIF) file into the loop.

WXP Loop Modes

Wxploop can be run in one of two operational modes:

  • INTERACTIVE
    Interactive mode allows the user to communicate with the wxploop program, issuing commands to it via the loopset program. Once wxploop is started, a message queue is opened allowing interprocess communications with the loopset program. This message queue key ID is based on the window_num resource. Only one wxploop program can be invoked per message queue/window number. If a queue exists for a particular window number and wxploop is run, wxploop will exit with a warning "Unable to create message queue".   At this point, either the queue must be deleted or another window number must be picked. The window number allows multiple instances of wxploop to be run each having its own interactive interface. The loopset command has been set up with the "alloc" command which returns the next available window number after 20.

    The program initially starts in STOP mode and runs any commands passed through the command line. Then, if any image files either X window dump or GIF are specified, these are added to the loop in the order they appeared on the command line. Once the first image is loaded, the main window is opened and the program will animate the images (go to LOOP mode) once all are loaded into the program. After the images are loaded, the program animates those images and waits for commands to be entered via loopset where pixmaps can be created and deleted, images annotated and loop parameters changed.

    At any point through loopset, a window ID of the main window can be queried. This window ID can then be passed to any WXP graphics program by specifying the window device. Example return:

    +8627531:8627533:800x600 or +8627531:8627533 (if size is the default 640x512)

    Also, pixmaps can be created. The pixmap ID can be queried and graphics drawn directly to the pixmap by specifying its ID and size to the device resource.

  • BATCH
    wxploop can also be run in a batch configuration. By specifying a window number of -1, the wxploop program does not open up a message queue. This alleviates the problem of having to allocate a different message queue for each wxploop window. Obviously, this lack of interactivity limits the capability of wxploop. This configuration is optimal for simple overlay displays and cannot be used for animation since there is no way to create pixmaps with a shell script.

    The program will run those commands pass on the command line and load any images in listed on the command line. The program will then print the window ID of the main window allowing WXP programs to access that window with the window specification under the device resource.

    Then the wxploop program will automatically background itself. This way, the window ID can be set to a shell variable and passed to another graphics program. Manual backgrounding is not necessary with "&" on the command line and is also not recommended.

NOTE for X Windows: When plotting graphics to a wxploop window or pixmap, it is highly recommended to allocate all colors used in the final graphic by using the "color" command. If this is not done, only the default color table is loaded (normally "wxp.clr"). Even though each WXP program allocates its own colors, these only remain allocated for the duration of each graphics program that is independent of wxploop. Once the graphics program exits, the colors are deallocated and those colors displayed on a wxploop window or pixmap may be changed by the next program that wishes to allocate colors. Running the "color" command in wxploop will allocate those colors in the color table. If a graphic uses multiple color table, the "color" must be run again to allocate the other color tables. This command does not deallocate any previous colors.

Once a loop has been created, it can be saved to either X window dump or GIF files. Then these files can be read back into wxploop later on and again animated. Another key feature is the check command that will determine if an image is already in the loop based on image titles.


For further information about WXP, email technical-support@weather.unisys.com
Last updated by Dan Vietor on June 24, 1998