ArtWorks Made Easy
9: Sprite Handling
Sprites, sometimes called bitmap images, may be regarded as portions of screen, that is. rectangular blocks of the coloured dots called pixels of which the screen is composed. They are very widely used in computer graphics, and since they can be plotted easily on screens they are comparatively simple to interchange between different computer types. They are also the form in which scanners and video digitisers provide their output. Many computer art packages also save their output in sprite format and you are probably familiar with the RISC OS Paint application which allows you to create and edit sprites and also to capture areas of the screen as sprites.
Many sprite formats are in use and applications such Acorn's ChangeFSI are available to convert 'foreign' sprite types to RISC OS sprite format.
Sprites may be any size. Often whole screens are saved, a VGA- standard screen (mode 27 etc.) becoming a sprite that is 640 pixels wide and 480 pixels high. Sprites may be larger than a screen. When an illustration measuring 4x3 inches is scanned at 400 dots per inch the output is obviously a sprite consisting of 1600 x 1200 pixels, and some are very small, just a few pixels per side, such as the characters and icons that appear in the RISC OS desktop.
ArtWorks allows you to import sprites and use them in documents. It also provides a number of operations on whole sprites, but does not allow you to edit the actual pixel structure of a sprite. For that you must at present use a separate sprite editor application such as Paint. It is possible that third-party companies may in future devise 'modules' that can be incorporated into Artworks to provide sprite editing facilities.
It is important to remember that each RISC OS sprite has a name. Often sprites are used in collections and the RISC OS sprite file format allows any number of sprites in a file. Each sprite in a file or in the same reserved area of memory must have a unique name by which it can be identified by applications.
Each sprite also has a screen mode, normally the mode in which it was created. If a sprite's screen mode is not available on your computer, the sprite will be invisible. Each sprite may optionally have a palette which records the composition of the colours it uses and a transparency mask which allows some (or all) of its pixels to be transparent. When a pixel is transparent, it is not plotted, that pixel retaining its previous colour. This gives the impression of a hole or window through which the background can be seen. By making pixels around the edge of a sprite transparent, the sprite may appear to have a shape that is other than rectangular.
Importing Sprites into ArtWorks
There are three ways in which you can import sprites into ArtWorks:
If you import a sprite file containing a sprite which has the same name as a sprite already in the sprite pool, the new sprite will be renamed, normally by appending a digit to the end of its name. This differs from many other applications where a newly imported sprite usually replaces an existing one having the same name.
You may select one or more sprites in the Sprite pool by clicking SELECT on the first item and ADJUST on subsequent items. Various operations may be applied to the selected sprite(s).
Clicking MENU while the pointer is in the Sprite pool window calls up a menu of the following five items
The Selected Sprite Menu
This is the menu that opens if you move right on the second item in the Sprite pool menu when one or more sprites are selected.
To use a sprite in the document simply drag it from the Sprite pool window into the document window and drop it at the point where you want it to appear.
When a sprite is in the document, the following operations can be performed on it.
Note that if you scale a sprite in a document that is to be printed, the choice of scaling factor is critical. Some sprites, such as monochrome sprites from scanner driver software, contain a half-tone screen made up of clusters of pixels. When this type of sprite is scaled, unsightly Moire fringes (banding or striping) may occur in the printout unless you choose a scaling factor that allows each pixel in the sprite to be reproduced as an equal number of dots by the printer. In general, if you are using a 300 or 600 dots per inch printer you should use scaling factors which are multiples of 30% (use 90% to reproduce the sprite at its natural size) and if you are using a 360 dpi printer, keep to multiples of 25% (100% representing natural size). With other types of sprite, the problems are less pronounced, but noticeable irregularities may result (e.g. in the thicknesses of strokes in characters in screendumps) unless you restrict yourself to the same critical scaling ratios.
The envelope, perspective and blend operations cannot be applied to sprites.
Sprite Info Box
Sprites in ArtWorks have information boxes. An example is shown below.
The top panel of the box provides useful information about the sprite itself. The middle panel provides position and scaling information about the currently selected image of the sprite in the drawing. The fields are all writable and so you may enter values if you wish to move, scale or change the sprite's aspect ratio (.i.e. its height to width ratio), but you must click on the appropriate button either to enter an absolute new width and/or height or to change the scale or aspect.
The bottom panel is concerned with the sprite colours. View is the default setting. Process replaces the two top panels with an RGB colour editor, shown below, which can be used to edit the colours in a sprite. Only the RGB colour model is used, since this is the way in which sprite colours are generally defined.
Contone is short for continuous tone and is only selectable if the sprite is a two-colour type, as obtained from a monochrome scanner. The two colours are defined as the start colour, generally the dark colour or ink colour, and the end colour, that is, the background or paper colour. Intermediate shades are obtained using clustered dithers. The dialogue box, shown in Figure 9.3, allows you to change the two colours in the sprite by choosing alternatives from the regular colour menu (the existing sprite colours are added to the colour menu). You can make a black and white sprite by changing its colours to sepia and cream or to dark brown and pale blue. You can also force such a monochrome sprite on to a spot colour plate. Use a spot colour for the start colour and either white or a tint of the spot colour as the end colour.
Click on View to return to the sprite information.
Display of sprites
The appearance of certain sprites on the screen in ArtWorks can be improved dramatically by allowing the software to introduce dithering. This is enabled by selecting a new option on the ArtWorks document dialogue box, as described in Chapter 11. Sprites that benefit most are contone sprites and those that display colours not available in the current palette. Grey-scale sprites are dithered whether this option is selected or not. Only the screen display is affected, not printouts or the actual sprite structure.