RISC OS 3.7 User Guide


19 Paint


Paint is a pixel-based picture editor; you can use it to 'paint' coloured images by applying colours to an area with a variety of brushes and painting tools.

You'll probably find that the easiest way of learning Paint is to read through Basic ideas (on the next page) and then work through the Paint tutorial which follows, before coming back to the Paint reference section starting on page 297.

Starting Paint

Paint is in the Apps icon bar directory display. To start Paint and create a new sprite:

1 Double-click on the !Paint icon to install it on the icon bar.

2 Click on the Paint icon bar icon to display the Create new sprite window.

3 Fill in the details for your new sprite and click on OK (it's probably best to follow the tutorial starting on page 285 if you don't already know how to do this).

Alternatively, edit an existing sprite file by dragging its file icon to the Paint icon on the icon bar, or by double-clicking on it.

Basic ideas

The pictures produced by Paint are called sprites.

A sprite is a graphic shape made up of an arrangement of pixels (the smallest unit the screen uses in its current mode). Sprites are stored in sprite files, which can contain more than one sprite. Sprites and sprite files use a standard format, so you can freely export images produced by Paint to other RISC OS applications (such as Draw) that recognise sprites. You can also use Paint to edit sprites produced by other RISC OS applications, and to import and edit JPEG files.

The important difference between Paint and Draw is that, unlike Draw, Paint knows nothing about 'objects' such as rectangles and circles; all it knows is the colour of each pixel in a sprite. Although you can paint regular shapes, you cannot then select them in order to delete, move or resize them.

When you export (save) a sprite from Paint into Draw, this remains true: regular shapes forming part of the sprite cannot be edited like Draw objects. The whole sprite becomes a single object in your Draw diagram; you can move or resize it, but not otherwise edit it.

Choosing colours in Paint

Paint can create and edit pictures in any RISC OS screen mode: 16 million colours, 32 thousand colours, 256 colours, 16 colours, 4 greys and black and white. There are two different ways of choosing colours in a sprite:

Creating sprite files compatible with earlier versions of RISC OS

If you want to create sprite files that are compatible with earlier versions of RISC OS, make sure you choose a sprite type that has an equivalent old-type mode number. See page 315 for more information.

Paint reference section

This section tells you in detail how to use Paint, and outlines the terms, concepts and basic techniques for creating and editing sprites. For a brief introduction to Paint and sprites, see Basic ideas on page 284.

Paint has several windows with specialised functions:

Creating a new sprite

To create a new sprite:

1 Click on the Paint icon on the icon bar.

2 Define the sprite's attributes in the Create new sprite window:

The table overleaf tells you what all the options in this dialogue box mean.

To:

Note: You can normally ignore the colours (mode) box. If there's a number shown here, the sprite is created as an old format sprite. If it's blank, the sprite created is a new format sprite.

Handling sprite files

It's easy to become confused over the difference between sprites and sprite files. This section shows you how to create and manipulate sprites and sprite files.

If you prefer, you can keep just one sprite in each sprite file. However, you can store many sprites in a sprite file:

To:

Manipulating sprites within a sprite file

You can perform various operations on the sprites in a Sprite file window:

To:

Adding an existing sprite to a sprite file

There are three ways of adding an existing sprite to a different sprite file:

Handling JPEG images

You can also use Paint to edit JPEG images. To load a JPEG file into Paint, drag the JPEG file icon onto Paint's icon bar icon.

The image will be converted into a sprite in the current screen mode. This means that it will be given the same number of colours as the current mode, so make sure you change to the correct mode before you load the image.

If you drag a JPEG file onto Paint's icon, a Sprite file window, a sprite window and a colours window will all open, ready for you to edit the image.

Notes:

Choosing and using colours

You use the Colours window to choose the colour that you are painting with. There is a separate Colours window for each sprite. To open the Colours window (if it's not already displayed) click Menu on the sprite window and choose Paint/Show colours.

There are in fact two different Colours windows (see Using colour in applications on page 179 for details on the second of these two windows):

Choosing a colour

To choose a colour, click on it in the Colours window.

For sprites with up to 256 colours, the current colour is highlighted in the colours window, and shows the colour number. The colours shown are the shades that can be displayed in the current screen mode. These may be an approximation to the actual palette of the sprite (see Mixing new colours using a palette on page 304).

Finding out the colour of an individual pixel

Another way to choose a colour is to point at a pixel in the sprite window, click Menu and choose Paint/Select colour. You can use this method to find out exactly which colour has been used to paint the pixel.

Making the Colours window smaller

You can make the Colours window smaller by clicking Menu over the sprite window and choosing Paint/Small colours. This toggles the size of the sprite colours window; the colours window must be open. The small colours window takes less screen space than the large one. This is particularly valuable in 256-colour modes.

Using a transparent mask

If a sprite with up to 256 colours has a mask, an extra, special colour is shown in the bottom lefthand corner of the sprite colours window as a shaded square.

If a 32-thousand or 16-million colour sprite has a mask, you will be able to select it by choosing None in the bottom of the Colours window.

Adding a mask

If a sprite doesn't have a mask, you can add one by clicking Menu over the sprite window and choosing Edit/Mask.

For more information about using masks, see page 295.

Applying colours using logical operators

There are four different ways in which you can apply colour to a sprite, using the Set, OR, AND and EOR buttons in the tools window (the tools themselves are described starting on page 306).

Set causes the colour itself to be painted into the sprite. The remaining three styles cause the indicated logical operation to be applied between the colour number of the pixel on the screen and that selected in the Colours window.

For example, if you choose EOR, spraying with colour 11 (binary 1011) onto an area that is currently colour 12 (binary 1100) will produce pixels in colour 7 (binary 0111). For a description of logical operations, see the BBC BASIC Reference Manual.

You can set a sprite's palette by dropping a palette file onto the sprite window - see page 305 for more on saving palette files.

The most interesting effects are achieved when spraying over a range of existing colours, or drawing overlapping filled shapes. Experiment for yourself!

Mixing new colours using a palette

For 32K and 16M-colour sprites, you can paint a pixel in virtually any colour by choosing it from the Colours window. However, sprites which use 256 colours or less only have a limited range of colours to choose from. In such cases, if a sprite has a palette, you can use it to mix new colours.

Giving a sprite a palette

If a sprite doesn't have its own palette, and you want to give it one, click Menu over the sprite window and choose Edit/Palette. Sprites which don't have their own palettes use the default desktop palette for a given mode (unless Display/Use desktop colours is off, in which case the old BBC colours are used).

By default, when you create a new sprite, it is given a palette.

Notes:

If you want to use a sprite as a tiled backdrop, it should not have a palette.

If you intend to export a sprite to Draw, you should give it a palette (otherwise it won't retain the colours you give it).

Redefining colours (editing a palette)

This method works for all sprites with up to 16 colours, and with 256-colour sprites with true-colour palettes.

1 Click on the colour in the Colours window that you want to change.

2 Click Menu over the sprite window and display the Paint/Edit palette/Edit colour box.

3 Mix a new colour and click on OK to redefine the Colours window.

Using colour in applications on page 179 tells you how to mix colours. The colour displayed is the best approximation available in the current screen mode to the shade you select. The exact colour is recorded by Paint; it is displayed more accurately if you change to a mode with more colours.

256-colour sprites with colour palettes

The one exception when mixing new colours is a 256-colour sprite with a colour palette (as opposed to a true-colour palette). In order to be able to edit such a sprite's palette, you need to save its palette back into the sprite window (see below). Alternatively, you can create a 256-greyscale sprite and edit its palette.

Saving a palette

To save a sprite's palette:

1 Click Menu over the sprite window and display the Save/Palette box:

2 Drag the Save as icon to a directory display.

If you want to use the same palette in another sprite, drag this palette file onto the new sprite window. This modifies the palette used by the sprite.

Creating an extended colour fill (ECF)

Note: ECFs are only really provided for backwards compatibility. We don't recommend that you use them.

To create an ECF, click Menu over the sprite window and choose Paint/Select ECF. This leads to a dialogue box which you can use to extract the bottom lefthand pixels of a named sprite as an ECF pattern. ECFs are patterns that you can use in place of a colour, and are added to the sprite palette, below the plain colours.

You can't define an ECF for sprites with more than 256 colours. You can define up to four ECFs for each sprite.

Zooming in and out (scaling a sprite window)

To scale the size of a sprite window to make it easier to edit, press Menu over the sprite window and set a zoom factor in the Zoom/Magnifier dialogue box:

The magnification only changes the size at which the sprite is displayed in the window; the actual definition, height and width are not affected. The magnification is expressed as a ratio; for example 2:1 means twice normal size, 3:4 means three-quarters of normal size, and so on. You can change the ratio either by clicking on the up and down arrows, or by typing in a new value at the caret.

Using a grid

You can use a grid to see the boundaries between individual pixels in a sprite:

To:

The grid is displayed at different magnifications for sprites of different sizes (so for example, you might only see the grid at zooms of 3:1 or higher for one sprite, but at zooms of 5:1 or higher for another).

Using Paint's tools

You choose tools from the Paint tools window to edit a sprite (or JPEG file).

If, when you open a sprite for editing, the tools window doesn't appear on the screen, you can display it by clicking Menu on the sprite window and choosing Paint/Show tools.

The top section of the window shows the tools. The currently-selected tool is highlighted and its name shown below the icons.

Below this are buttons used to define how colour will be applied to the image. When certain tools are selected, an extension may appear at the bottom of the tools window for setting extra parameters.

Choosing tools

To use a tool to edit a sprite:

1 Click on the tool in the Paint tools window.

2 If you want, set or change any parameters, such as the size of the spray or brush to be used.

3 Choose a colour from the Colours window.

4 Move the mouse to the sprite window, and apply the tool as described below.

For operations such as drawing lines and rectangles, you can click Adjust instead of Select. This moves the point you just set to the current position.

While some operations are in progress, a skeleton line or area is shown.

You can cancel any of the sequences of operations described below by clicking again on the current tool in the Paint tools window.

Function/Tool to choose:

Using a sprite as a brush

Here's a bit more on using a sprite as a brush (there are a couple of examples of using this tool in the Paint tutorial:

To:

Changing a sprite's size, shape and orientation

You can perform many operations on a sprite using Paint's Edit menu (click Menu over a sprite window and choose from the Paint/Edit submenu):

Function and option to choose:

More on adding and deleting rows and columns

Enter the number of rows or columns in the How many? box and click Select or press Return. Alternatively, without passing over a menu, move the pointer over the sprite window to change the size of the highlighted area that appears and click when the How many? box shows the right number.

Deleting the column of pixels on the righthand edge of a sprite can be difficult. Increasing the zoom scale can help, or you can delete the last column separately by using Adjust size to decrease the width by 1 column.

Taking screen snapshots

You can use Paint to save part of the screen as a sprite file (this is how the pictures of menus, windows and so on were produced in this User Guide).

Start snapshot by choosing Snapshot from the icon bar menu. This displays the snapshot dialogue box:

Function/Procedure:

Printing a sprite

Before you can print a sprite, you must have the Printer manager loaded. There are two ways you can print a sprite:

The dialogue box is the same in both cases. The exact contents of the dialogue box depend on the printer driver in use, but it typically allows you to choose the orientation (Portrait or Landscape) scaling, and position on the paper.

Scale allows you to change the proportions of the printed image. Setting both x and y to 1:2 will produce a half-sized image.

Corner defines where on the printed page the image will be printed. The default settings define the edge of the printable page for your printer. Changing these settings will move the printing position of the image.

Saving Paint features in a Desktop boot file

You may want to change some aspects of the way new Paint windows appear when you first open them. For example, a new window normally opens with Zoom magnification set to 1:1, but you may prefer to have the Zoom option set to 2:1 each time you start Paint.

You can set features of this type by setting up Paint as you want to use it, then save these features by creating a Desktop boot file. Instructions on how to create a Desktop boot file are given in Configuring applications on page 427.

There are several features of Paint that you can set before saving a Desktop boot file, so that they are set up the way you want them each time you switch on.

Types of sprite that can be created by Paint

This table gives the various types of sprite that can be created by Paint. It shows if

You can select these combinations using the Create new sprite window. See page 297 for more information.

Number of colours/Dots per inch/Equivalent old mode number:

Note: If you create a sprite file on your computer containing a sprite with no mode number, be careful if you use it with an older Acorn computer running RISC OS 3.10 or earlier, as switching to the brush tool in Paint on RISC OS 3.10 or earlier whilst editing the sprite file will cause Paint to crash.

This sort of file is easy to identify, as at least one of the sprites will fail to show in the sprite file window on those versions of Paint.

You can find out if your sprite file has a such a sprite by displaying the sprite file window using the Full info menu option.


[1] For very large sprites (height greater than 1024 pixels) some Paint tools may not work properly (e.g. Replace colour).
[2] If you drop the Save/Save as icon onto another Sprite file window instead, any existing sprites in that window with the same name will be replaced.
RISC OS 3.7 User Guide - 22 JAN 1997