Carousel  -  Displays a sequence of images

by Alan Wrigley


This is an updated version of an application first published in RISC User 7:6 and updated in RISC User 9:4. It enables you to display a sequence of images in a continuous carousel in a multi-tasking window on the Desktop.

The application will display Sprites (squashed and unsquashed) or JPEGs. Bear in mind that 32000 and 16 million colour sprites cannot be displayed on older machines (pre-RISC OS 3.5) since the old ColourTrans module does not recognise the new formats.

Running the application opens the control panel. In the lower section of this window is an icon onto which you may drop a directory folder containing any mixture of files. Provided that there are at least two images (sprites, squashed sprites, or if you have a machine capable of handling them, JPEGs) among the files, the carousel will be activated. A window will open with the first image in the directory displayed. The other images in the directory are then shown in turn, with an initial time interval of 5 seconds (this can be altered, as described later). When the last picture has been displayed, the sequence wraps round again to the first. The window may be moved around as usual, and also re-sized. Although at first sight it may appear that the window cannot be made larger, since the scroll bars are fully extended, clicking on the window's Adjust size icon and holding the mouse button down will cause the image window to go blank and the scroll bars to shorten. You can now resize the window over the whole screen area. When you release the mouse button, the picture will be re-displayed at the new size.

Clicking Menu over the window opens a menu with one item, namely Controls. This allows you to open or close the control panel - the item is ticked when the panel is open.

The upper section of the control panel has 5 toolbox-style icons. From the left, these are the Full-screen tool, the Aspect tool, the Pause tool, the Back tool and the Next tool. Clicking on the Full-screen tool causes the carousel display to take over the entire screen. To return to the original windowed display, simply click on the mouse. The Aspect tool enables you to preserve the original aspect ratio of each image. If this is turned off (the default state), each image is always resized to fit the current window size exactly, regardless of the aspect ratio. If it is turned on, the original aspect ratio of the image is preserved. This means that if the x:y ratio of the window is greater than that of the image, the picture will not completely fill the window in the horizontal direction, while if it is less, the same will be true in the vertical direction. Clicking on the tool toggles the setting on or off.

Clicking on the Pause tool pauses the carousel at the currently displayed image. When Pause mode is on, the Back and Next tools can be used to display the previous or next image in the sequence respectively. When Pause mode is off, these twotools are inoperative.

The central section of the control panel controls the time interval. To alter the interval, type a value in seconds into the writable icon and then either press Return or click on the Set delay icon.

Clicking on the main window's Close icon, or clicking on the control panel's Close icon if there are no images loaded, terminates the application.

The updated version published on the 9:4 magazine disc added the facility to use squashed sprite files as well as standard ones, as mentioned earlier. For details of how to use the Squash module to compress and decompress files, see the Wimp Topics article in the RISC User 9:4 magazine.

This latest version allows you to display images from any directory, rather than just a set of sequentially-numbered sprites from a specific directory as before. It also handles JPEG images, provided that you have the SpriteExtend module version 0.99 or greater (as standard with RISC OS 3.5+). If this version isn't present, JPEG files will be ignored when loading a directory of images.

The techniques involved in displaying JPEGs as a native image format are described in the Wimp Topics article in this month's RISC User magazine.

 Copyright RISC User Magazine 1994,,1997
