Budget DTP
on RISC OS

9 : Sprites, !Paint and Clip Art

Chapter 5 mentioned that there is an alternative technique for creating graphics, one which involves building up the designs using rectangular arrays of identically sized variously coloured dots called picture elements or pixels. These often, but not always, correspond with the dot structure of the monitor screen. Graphics built up in this manner are known as sprites.

Sprites may range in size from just a few pixels to a whole screen or even larger. RISC OS computers have a very sophisticated sprite handling capability which allows sprites created in one screen mode to be displayed sensibly in other screen modes. Their original proportions are maintained and their original colours are represented by dither patterns if they are unavailable in the new mode. The RISC OS application IPaint allows you to create and edit sprites.

Using Sprites in !Draw

Sprites can be freely introduced into !Draw windows and used to illustrate or decorate pages. You simply drag the sprite's icon into the !Draw window. Once in !Draw it can be moved and scaled using the "Select" facility. It can also be mirror-imaged or inverted but not rotated.

There are, however, two factors that you must consider when using sprites in 'Draw documents. Firstly, they can use up a considerable amount of memory, especially if they were created in a multi-colour screen mode such as Mode 20 or Mode 12. Add two or three average- size multi-colour sprites to a page of A4 and on a one megabyte machine you may well find yourself running out of memory. If you are creating your own sprites, it helps if you create them in one of the less demanding screen modes. If your sprite needs only two colours, if it is a black and white line drawing for instance, create it in Mode 18 or Mode 0 rather than Mode 20 or Mode 12.

Secondly, printers reproduce sprites rather differently from text and drawings. Sprites are screendumped. This means that each pixel in the sprite (or perhaps each group of pixels if it has been scaled downwards) is converted to a pattern of dots on the paper that represents its colour. The printer, in fact, attempts to create a "screened" version in much the same way that professional printing companies reduce a half tone to a pattern of dots of varying size. If you are fortunate enough to have a printer capable of 300 dots per inch resolution, this screening process results in half tones that resemble coarse-screened newspaper half tones. On a 9-pin dot-matrix printer, the quality of reproduction of half tones is really not adequate for reproduction, unless you subsequently reduce the size of the illustration on a photocopier.

Sources of sprites

There are many sources of sprite graphics. If you save a screen using the "SCREENSAVE command, the resulting file is a sprite which can be edited in 'Paint. This facility is useful as it allows you to import whole screens, or parts of screens, from other software. For example, I once illustrated an article on music using lines of musical notation culled from 'Maestro by saving the screen, loading the resulting file into .'Paint, editing out the staves I wanted and saving them for later reloading as sprites into !Draw. (The musical symbols, however, looked crude in contrast with the surrounding text. Better looking musical notation can be obtained using path-object musical symbols for this purpose.

Scanners and Video Digitisers

You can convert existing drawings, paintings and even half-tones such as photographs into sprites using one of the many hand scanners now available. With a little practice these can give excellent results. If you reproduce an illustration from another publication, however, you could be infringing the originator's copyright. Always obtain permission first.

By means of a video digitiser you can convert TV pictures from videotapes or video discs to sprites. Again, if you plan to reproduce the resulting sprites, be careful about copyright!

Clip Art

Some software distributors offer collections of sprites as "Clip art". These may include half tones, drawings, diagrams, notices or logos. The software distributor supplies them for the express purpose of assisting the user to illustrate or decorate the documents he is producing with the aid of his computer system. Hence the purchase of the clip art of necessity includes the right to reproduce the sprites ad lib on paper without acknowledgement. It does not, however, include the right to distribute the software to a third party unless permission is given first.

There is also some clip art available in the form of path objects. The designs are generally simpler than those supplied as sprites, although some are remarkably sophisticated.

Sprite attributes and sprite files

Each sprite is stored as a block of data which contains, besides the colours of the pixels, other vital pieces of information about the sprite. These are called the sprite attributes. Each sprite has its own name which follows the conventions for filenames, eg up to 10 letters long. The sprite name will probably have little significance in DTP except as a means of identifying the sprite. Each sprite also carries its width and height (in pixels) and the screen mode in which it was created, since this affects the shape of the pixels used and therefore the proportions of the sprite.

Optionally, a palette may be saved with the sprite. This allows the sprite to use specially created colours and to ensure that, wherever possible, it is subsequently displayed in these colours.

Furthermore, each sprite can optionally have a mask, sometimes called a transparency mask. This is effectively a map of the sprite showing which pixels are transparent. If a pixel is transparent, the sprite's colour is not displayed. Instead, the colour of the background, or any other object behind the sprite, can be seen. By making pixels around the edge of the sprite transparent, the sprite can be effectively made any required shape. If no mask is present, none of the pixels are transparent and the sprite is by definition a "solid" rectangle.

Each sprite can be saved as an individual sprite file. Several sprites can, however, be collected together and saved in one file. This practice is not recommended on a one megabyte computer, as the resulting file may be so long that, when reloaded, there is not sufficient memory available to edit it into its individual sprites.

Using !Paint

The !Paint application in the RISC OS applications suite is a very versatile piece of software for editing and creating sprites and surprisingly easy to use. It is in some respects similar to the Quest Paint application for the BBC Micro, with which some readers may be familiar. In general the User Manual explains !Paint well, but the following may help you on points which are not clear. You are strongly advised when using !Paint, as when using other creative software, to save your work very frequently. A wrong key press can easily ruin your work and it is useful to be able to return quickly to an earlier but recent stage.

Get screen area

!Paint is loaded in the normal manner, its icon appearing on the icon bar. Clicking MENU on the icon offers the usual information about the version in use and the option to leave IPaint with the facility for saving any unsaved work. But it also leads to a very useful utility, "Get screen area". This allows you to save to disc any rectangular portion of the current screen display. To use this, you should first open a directory viewer, or another application window, into which the resulting icon can be dragged. When you click SELECT on this option, the pointer changes to a camera with an arrow. Move this to one corner of the area you wish to save and hold down SELECT. Keeping select held down, drag the pointer to the opposite corner of the area to be saved-you will drag out a "box" as you do so. When the box encloses the required area release SELECT and the box disappears. A dialogue box now appears in which you can enter a filename. You can save the file by dragging the icon into a directory viewer. The resulting file is a sprite file which can be subsequently loaded into IPaint for further editing if needed. Alternatively, you can automatically add it to an application by dropping it on an appropriate application window, such as a !Draw window. Another option is to drag it onto an icon (such as the !Paint icon itself) to start up a new window containing the sprite.

Editing existing sprites and creating new ones

To load a sprite file into !Paint drag its icon on to the !Paint icon or, with !Paint installed, double-click SELECT on the sprite file icon. This will open a sprite file window in the top left-hand comer of the screen. In this will be displayed one or more sprite images. These may be full size if the sprite itself is small. However, if the sprite is large, it will be a reduced-size image which may have a distinctly "fuzzy" appearance.

If you wish to start a new sprite file from "scratch" click SELECT on the IPaint icon and a blank sprite file window will be opened. Use the "Create" sub-menu from the sprite file menu - see below to set up your first sprite.

The Sprite File Menu

Clicking MENU with the pointer in the sprite file window leads to the following menu which is concerned with operations on the file and on any whole sprites it contains rather than the editing of sprites themselves.

  • Info - This gives information about the sprite file such as its filename (and path), the number of sprites it contains, whether it has been modified since it was loaded and the length of the file in bytes.
  • Save - This allows the file to be saved using the normal RISC OS conventions.
  • Create - use this if you wish to create a new sprite from "scratch". A dialogue box will prompt you for a name for the sprite, its width and height in pixels, its screen mode (which need not be the mode currently in use) and whether or not it will have a mask and a palette. These are in fact the standard sprite attributes.
  • Sprite 'name' - if the pointer was not over a sprite image when you clicked "menu", there will be no sprite name between the quotes and the option will be greyed out showing that it cannot be selected. Otherwise it leads to the following sub-menu of operations that can be performed on the sprite named.
    • Delete removes the sprite from the sprite file-it is lost irretrievably unless you have a copy elsewhere.
    • Copy prompts you for a new sprite name and creates, in the same file, a copy of the sprite which is identical in all respects except that it has the requested new name. Rename prompts for a new sprite name for the sprite concerned.
    • Save allows the sprite to be saved as an individual sprite file.
    • Info displays the attributes of the sprite.
    • Print leads to a dialogue box which allows a copy of the sprite to be printed, assuming of course that the appropriate printer driver has been installed.
  • Display - this controls options regarding the contents of the sprite file window. A tick appears by each option currently in force. The default is Drawing and name. An alternative is Full info. The Use Desktop Colours option forces the display of sprites using the current desktop colours and ignoring any palette saved with the sprite. (By default sprites which have palettes are displayed, where possible, using the colours in the sprite's own palette.)

The Sprite Menu

To actually edit a sprite you must double click SELECT over the sprite image in the sprite file window. (The sprite "image" will of course be blank if you have just created a new sprite.) This opens a sprite window containing a full-size image of the sprite concerned. Clicking MENU with the pointer in the sprite window leads to a menu of operations concerning the sprite. Some of these are duplicates of options available from the sprite file window.

  • Info - displays the attributes of the sprite.
  • Save - this leads to a sub-menu allowing the sprite and its palette to be saved individually.
  • Paint - this leads to the "Paint" menu which is concerned primarily with colours. This is considered later.
  • Edit - this leads to the "Edit" menu which is concerned primarily with the sprite's size and orientation. This is considered later.
  • Zoom - this leads to a zoom dialogue box exactly like the one in .'Draw. It allows the window to show an enlarged or reduced view of the sprite. For editing work on sprites it is almost essential to use a magnification of at least 4 times.
  • Grid - this leads to a sub-menu offering a choice of colours for the grid. Note that the grid is only displayed if the zoom facility (above) is set to a magnification of 4 times or more.
  • Print - this allows the sprite to be printed.

The "Paint" Menu

  • Select ECF (Extended Colour Fill) - this allows you to use predefined dither patterns as though they were colours from the palette. The pattern must have been previously set up using ! Paint and saved as a sprite. See the User Manual for more detailed information.
  • Select colour - this allows you to alter the currently selected colour to the colour of the pixel in the sprite which the pointer was pointing to when you clicked MENU. The currently selected colour is the one highlighted (by the presence of its number) in the colour window. You can also use this facility to identify the colour of any pixel about which you may be in doubt.
  • Show colours - this opens the colour window (if one is not already open). You can alter the currently selected colour by clicking SELECT on the one you want to use.
  • Show tools - this opens a window showing the very wide range of brushes, pencils, sprayguns and cut and paste facilities available for sprite editing and creation. Note that all this work uses the currently selected colour. A "help" line is provided. This is most useful as it explains the nature of operations which are not always obvious from the icons. See the User Manual for more detailed information.
  • Small colours - this controls the size of the colour window. It is most useful when working in 256 colour modes since these obviously demand a very large colour window.
  • Edit palette - this leads to the familiar palette dialogue box in which colours can be redefined.

The "Edit" Menu

  • Flip vertically - this produces a reflection of the sprite.
  • Flip horizontally - this produces a mirror image of the sprite.
  • Rotate - this leads to a writable sub-menu in which you enter the number of degrees anti-clockwise through which you wish to rotate the sprite. The default is 90 degrees. For clockwise rotation either enter a negative number, eg -90, or subtract the angle from 360. Note that rotation is a very time consuming operation!
  • Adjust size - this changes the boundary box of the sprite. Be careful! Making the sprite smaller may cause detail to be lost from around the edges. Once it has been lost, it cannot be regained (unless you have it saved on disc). Two methods are provided - you can either click on directional arrows or write the new size in pixels. Note that despite the positioning of the arrows, all vertical adjustments are made to the top edge of the sprite and all horizontal adjustments to its right-hand edge.
  • Insert columns/Insert rows - these allow additional rows and columns of pixels to be inserted at any position in the sprite. Note that the new columns or rows will be inserted at the position of the pointer when you clicked "menu". A vertical or horizontal line will appear through the sprite at the position where the new material is to be inserted. A dialogue box will ask for the number of columns or rows to insert. You can either type a number and then press <RETURN> or move the pointer within the sprite file window to indicate the number and then click "select".
  • Delete columns/Delete rows - these allow adjacent columns or rows to be deleted from the sprite. The operation is most useful for trimming the edges from very large sprites such as those created by scanner-driver software. When you use the former method the lines deleted will automatically be taken from above or to the right of the line. Using the latter, a second line will follow the pointer indicating the limit of the area to be deleted. Note that this operation is somewhat temperamental. You must take the pointer straight off the menu and into the sprite window without touching any other part of the menu structure. Otherwise the operation is cancelled. A dialogue box shows the number of columns or rows. You can either edit this number and then press <RETURN> or move the pointer within the sprite file window until the required number is indicated and then click "select". Note that the columns or rows will be deleted starting from the position of the pointer when you clicked "menu". A vertical or horizontal line will appear through the sprite at this position.
  • Mask - this toggles the mask on and off.
  • Palette - this toggles the palette on and off.

previousmain indexnext

 
© Alligata Media 2015