RISC OS 3.7 User Guide


17 Draw


Draw is a powerful and sophisticated drawing package; you can use it to draw and edit diagrams and pictures made up from various kinds of graphical objects.

You'll probably find that the easiest way of learning Draw is to read through Basic ideas (on the next page) and then work through the Draw tutorial , before reading the more detailed sections.

Starting Draw

Draw is in the Apps icon bar directory display. To start Draw:

1 Double-click on the !Draw icon, to install it on the icon bar.
2 Click on the Draw icon bar icon to open a new Draw window.

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

Basic ideas

The Draw window

The Draw window looks similar to other application windows when you first load it, except that down its lefthand side there is a strip of icons called the Toolbox. The Toolbox allows you to draw or select objects without having to use menus.

Draw objects

A Draw diagram is built up from objects of a number of different types. Draw stores information about each object, which means you can subsequently change individual objects without affecting the other objects.

The basic object types are:

You can combine objects together as a group which you can then (usually) manipulate like any other object. Draw records the objects that were used to build a group, so that it may subsequently be 'ungrouped' into its constituents. Groups can also be used as components of other groups.

Each object has a style consisting of a number of attributes. Attributes are used to define the colours of an object, line widths, text fonts and sizes, and so on. The exact range of attributes depends on the type of object.

Draw modes

You can use Draw in three operating modes:

Don't worry about these names too much - when you're actually using Draw you'll change between the modes without thinking about it!

The mouse pointer changes according to which mode you are using: in Enter mode it is shown as a star, and in Select and Path edit mode as an arrow.

Tools and short-cuts

To make it easier to construct a diagram, Draw has a number of tools and shortcuts:

The drawing area

When you start a drawing, the Draw window displayed on your screen only shows part of your actual drawing area. The drawing area is usually the size of an A4 sheet of paper, but you can make it as small as A5 or as large as A0, depending on the size of the drawing you want to create. You can also decide whether the drawing area is a landscape rectangle (where the horizontal side is longer) or a portrait rectangle (where the vertical side is longer). You can use the scroll bars on the Draw window to move around the drawing area.

Draw reference section

In this section, each of the Draw functions, including those you used in the tutorial, are explained in depth. Don't worry if you don't understand every last word; the real way to learn Draw is by using it.

Undoing and redoing operations

As you create a drawing, you'll often decide that you want to undo the last operation you performed. It's easy to retrace your steps and correct any errors you make:

To:

Using the Grid to place objects accurately

You can superimpose a rectangular or isometric grid on a drawing. This is useful for lining up objects and for checking their relative sizes. The grid is made up of 'major points' (marked by crosses) and 'minor points' (marked by dots).

You can use the grid either just as a general guide for drawing, or you can lock objects to it, so that they always align with points in the grid (the exception is if you rotate an object). When you are creating objects with grid lock turned on, you will see them attach to the nearest grid point to the pointer position.

To:

Zooming in and out of your drawing

You can alter the apparent size of your drawing. For example, you might want to look at something close-up to position it accurately, or you might 'zoom out' to see your whole drawing at once. This doesn't alter the actual size of your draw objects.

To:

If you scale up an object in !Draw and then highly magnify the view, the object may disappear. To retrieve the object, undo these operations. Reduce the object's scaling so that it doesn't disappear again.

Displaying two views of the same file

Choose Misc/New view to create a new view of the drawing you are editing, in a separate window. Edits you make in one view of a drawing show up in the other views as well. You can change the zoom on each view independently, use different grids in the separate views, scroll each one independently, and so on. To get rid of a view, close the window containing it.

Creating objects (Enter mode)

This section describes each tool in the Toolbox. When you're in the process of creating any object (except text) you'll see a 'skeleton' version of it on the screen.

Hints

You can cancel most operations part-way through by pressing Esc or choosing Enter/Abandon.

You can retrace your steps using Misc/Undo (keyboard short-cut: F8).

You can choose tools from the Toolbox on the lefthand side of the Draw window, or by using the Enter submenu.

To:

Drawing multi-path objects with the Move tool

Creating a multi-path object

To create one object made up from multiple paths:

1 Choose one of the four line segment tools.
2 Construct the first path by clicking on the end points of each segment (don't double-click at the end of the path).
3 Click on the Move tool - the move icon will not be highlighted.

This lets you move to the start of another segment without drawing a line.

4 Construct the next path.
5 Repeat steps 1 to 4 until you've created all the paths and double-click to finish.

You'll now have a single object, made up of many paths. You can't 'ungroup' such an object. You can edit it, though (see page 242).

Creating a hole in a filled object

Here's an example of how to create a filled rectangle with a transparent hole in it:

1 Choose a fill colour from the Style/Fill colour dialogue box.
2 Choose Style/Winding rule/Even-odd (don't worry about this for now - it's explained on page 239).
3 Draw a rectangle using the Straight line tool (don't double-click to complete the shape; just click once to place the last point on top of the first).
4 Click on the Move tool (the move icon will not be highlighted).
5 Draw a smaller rectangle inside the first.

When you double-click, you'll be able to see through the hole:

Note: You can't start or end a path with a Move.

Manipulating objects (Select mode)

This section tells you how to select and deselect objects, and how to manipulate a selection.

Selecting and deselecting objects

Choose the Select tool (at the bottom of the Toolbox) to enter Select mode. In Select mode, you can make changes to existing objects. To return to Enter mode and draw another object, choose one of the other tools.

When you select an object, you'll see its bounding box, with handles at two of its corners (not all objects have these - see page 232).

To:

Copying and deleting objects

To:

Moving objects to the front or back of a stack

To:

Grouping and ungrouping objects

To:

Aligning objects (justification)

You can align objects, both vertically and horizontally.

Note: You need to group any objects before you can align them.

To:

In the following example three objects have been grouped and then justified left, centre and right:

Moving, rotating and scaling objects

There are different ways of rotating and scaling objects, depending on how accurate you want the operation to be.

To:

Creating special effects in Draw (interpolation and grading)

Using interpolation and grading you can perform the following operations on two grouped objects:

Changing one object into another object (morphing or tweening)

To change one object into a different object:

1 Draw two objects using the Joined line tool (see Restrictions on page 236).
2 Group the two objects together.
3 Enter the number of gradations into the Select/Interpolate or Select/Grade box (8 is the default value) and press Return.

A new set of objects will be drawn. Each new object is a partial transformation between the first object and the second object:

Interpolation produces a number of new paths, each consisting of two objects. You cannot ungroup these paths. This means that when you interpolate two objects you'll lose the original objects (Copy them elsewhere in the Draw window before you interpolate them, or use Undo to start again if you want). Grading produces new objects which are not grouped as paths:

Creating intricate patterns

You can create interesting patterns if one object is inside (or on top of) the other:

You can interpolate between curved shapes to produce very intricate patterns:

The difference between interpolation and grading is most evident when both shapes are closed and filled:

Properties used by interpolation and grading

The properties used by interpolation and grading are

Restrictions

A pair of path objects for interpolation or grading must have certain properties in common. For most practical purposes, this means they should be more or less the same shape (though they need not be the same size): two V-shapes, two rectangles, and so on. Specifically, the requirements are that

Defining a path object's style

Each object has a style consisting of a set of attributes (such as fill colour, line colour, line width and so on). Using the various Style menu options, you can

Any new object you create is given the style attributes currently defined in the Style menu. We suggest that you set up the style attributes before you actually draw an object. This can save you accidentally 'losing' objects because they're the same colour as the background.

Here's how to define an object's style:

To:

Adding arrows to line ends

Triangle caps are useful for creating arrows on the ends of line segments. You can set the height and width of a triangle cap independently. They are defined as multiples of the line width, as follows:

Triangle height = Cap height x Line width

Triangle width = 2 x Cap width x Line width

Filling objects with colour - the winding rule

Style/Winding rule allows you to specify which of two methods is used to fill different regions of an object with colour. It only affects objects for which a fill colour has been set. It's not commonly used, but you'll need to understand it if you're creating objects with transparent holes.

An object can be a single path (e.g. an ellipse), a collection of line segments, or a single line segment that crosses over itself any number of times.

Non-zero winding rule

This rule fills regions on the basis of whether they were drawn in a clockwise or anti-clockwise direction.

Note each region's direction as you draw it, clockwise or anti-clockwise, and give this direction a number: +1 for one direction and -1 for the other.

To see if a region is to be filled, construct an imaginary line from inside the region to outside the object. Keep a total of the direction values for each line it crosses. If the total is non-zero, the region will be filled (see the diagram overleaf).

In the following example, three rectangles were drawn clockwise and one rectangle was drawn anti-clockwise. The clockwise rectangles were assigned a value of +1, and the anti-clockwise rectangles were assigned a value of -1:

Even-odd winding rule

This rule fills regions if they are enclosed by an even number of other regions.

To determine whether a region inside an object is to be filled, imagine a line passing from inside the region to outside the object. Count the number of lines it crosses. If the number is odd, the area will be filled.

The following example shows this rule applied to a single path object made up of four regions (created using the Move tool - see page 229):

Defining text style

You can change the style attributes of text lines using the Style menu. If you select a text line first, that line will have the style applied to it. All subsequent text lines will also have that style applied to them.

To:

Superimposing text on a coloured background

Style/Background sets the intermediate colours used around the edges of anti-aliased fonts. You don't usually need to worry about this, but it's useful if you're creating text on top of a coloured object:

1 Set the Text colour of your text line.
2 Select the object on which your text is superimposed and note down its colour from the Style/Fill colour window.
3 Set the Style/Background colour of the text line to be the same as that you noted down in step 2.

The anti-aliasing pixels will be in a range of shades between the Text colour and the Background colour. Background applies to text objects and text areas.

Note: This effect won't be visible if the text size is larger than the value set for anti-aliasing in Configure (see page 46).

>Editing Draw objects (Path edit mode)

All objects you construct using Draw's tools are made up of paths. In turn, paths consist of straight and curved line segments. Each segment in a path has end points and (if it is a curve) control points.

You change an object in two ways:

Note: You can't edit Text areas, JPEGs or sprites in Draw. See pages 248 to 250.

Entering and leaving Path edit mode

You can only edit a single-path object in Path edit mode (so you'll need to ungroup any objects first).

Editing curves

Curved segments in a path object are defined by two end points and two control points. When drawing or editing a path, the control points are shown connected to the end points by straight lines.

The shape of a curve is determined by the control points as follows:

By moving the control points, you can produce many different shapes of curve. Some examples are shown below. In each case the thick line shows the path itself, and the control points (shown here as black squares, although they're yellow in the drawing) are joined to the corresponding end points (shown here as open squares) by thin lines.

If you hold down Shift while you drag a control point, the corresponding control point in the next curve is also moved to keep the angle of join constant.

Editing text lines

When typing in text, you can only delete text and type new text in if you are still on the same line. As soon as you press Return or click somewhere else in the drawing, the line is 'frozen'.

To:

Editing text as a path object

Once you've converted a text line to a path, it can be treated like any other path object (for example, you can use Style options that apply to objects other than text - see page 237).

For example, the following text was converted into a path, then ungrouped into individual letters, and each letter given a black line colour and a different fill colour (the second row of text was also given a much thicker line width):

Note: You can only convert outline fonts to a path.

Editing objects using the Path edit submenu

You can also change a path object's shape using menu options. This method gives you much greater control:

1 Enter Path edit mode (see page 242).

If the path you want to edit is under another object's path, double-click Adjust to tunnel through to the next deeper path.

2 Select a segment by clicking Adjust on an end point or a control point.

The line segment and end point will be highlighted (if you select the first end point of the path, there is no highlighting).

3 Click Menu to show the Edit menu.

Now you can edit the highlighted segment and end point:

To:

How 'Flatten join' works

This flattens the join between two adjacent segments (unless both segments are straight lines). The curve is adjusted so that the tangent is continuous at the selected end point. For example:

How 'Change to move' works

If the path containing the line was closed, extra lines will be inserted to close each of the two sections of the path:

Importing (loading) files into Draw

You can import five types of file into Draw:

To:

When you drag a file into a Draw window, it is added to any objects already in the window. The file is loaded so that its bottom lefthand corner lies at the mouse position at the instant the mouse button is released.

When you load a file by dragging it to the icon bar, the file appears in a new Draw window, aligned to the bottom lefthand corner of the diagram.

Loading a sprite into Draw

If you drag a sprite file containing many sprites into Draw, only the first sprite will be loaded. A more convenient method of loading a single sprite is to:

1 Load the sprite file into Paint.
2 Open a sprite window for the sprite you want to load into Draw.
3 Make sure the sprite has a palette (click Menu and switch Edit/Palette on).
4 Drag the icon in the Save/Sprite/Save as box into a Draw window.

This method also ensures that Draw displays the sprite in the correct colours.

Exporting (saving) files from Draw

You can save objects from a Draw file in their own native file format. This means, for example, that if a Draw file has an imported sprite, you can save that out as a sprite again.

Note: You need to be in Select mode to save anything other than the whole Draw file (see page 230).

To:

Note: The DrawFile format includes a 'Type 11' object which records details about the page size and orientation of the file. Some old applications may fail to load Draw files containing this object. To overcome this problem, load the Draw file into Draw, choose Select all and save the selection; this saves a Draw file without a type 11 object.

Printing Draw files

To print a Draw file:

1 Make sure you have a printer connected and set up (see Printing your files on page 143 and Setting up printers on page 125).
2 Make sure that your drawing will fit on the paper on which you are going to print (switch on Misc/Paper limits/Show then set the page size and orientation to match that of your printer).
3 Choose Misc/Print (or press the Print key).
4 Set the number of copies in the dialogue box and click on Print.

Only objects within the inner limits of the grey border in the Draw file will be printed. The outer limits of the grey border correspond to the limits of the page. If no printer driver is loaded, the limits default to A4.

Misc/Paper limits/Reset sets the paper limits to the printer driver defaults.

Printing part of a diagram

You can also select part of the diagram to be printed at a time. This enables you to print a drawing on more than one sheet, so that you can make up a poster, for example, from several standard-size sheets 'tiled' together:

1 Choose Paper limits/Show.
2 Hold down Ctrl and use one of these methods to define the printed area:
3 Choose Misc/Print, or press the Print key.

Text areas

A text area is a special sort of object that allows you to perform simple 'desktop publishing'. A text area consists of a piece of text divided into one or more rectangular regions called text columns. Draw breaks up the text into lines which are just wide enough to fit into the columns, splitting it (principally) at spaces.

You can create a text area by using Edit (for example) to prepare a file containing the text, annotated with special commands (described below). When you load the text file into Draw, the text is formatted into columns. The number of columns is given by an annotation. You can move the text columns and change their size in Select mode. As you do this, Draw will reformat the text between the columns.

Text areas only use anti-aliased fonts: you cannot create a text area in the system font. If you try to use the system font you will find that it is automatically converted into the Trinity font. See Default text area header on page 256. If you want to create a text area in system font, use the outline font version of the system font: choose Style/Font name/System/Fixed.

Creating and editing text areas

To create a text area from a text file, drag the file into a Draw window. The columns in the text area are initially set up to standard sizes. If you drag the text file over the top of a selected text area, the old text in the area is replaced with the contents of the new file. Use this method for altering the text in a text area.

Text area selection works in two slightly different ways, depending on how many text columns there are in the text area:

Single text columns

When there is a single text column in the text area, selection works in the same way as any other object. You can move the text area, scale it, change its style, and so on, as described above.

Multiple text columns

When there is more than one text column, selection is a two-stage process. When you first click (or click Adjust, in multiple object selection) over the text area, the entire area is selected. You can move the area, but it cannot be scaled. Double-click (or double-click Adjust) to select a column of the text area. You can move and scale individual columns. Their new position and size need not lie within the original text area.

When you change the size of a text column, the text is reformatted to fit the new size of the column.

To select more than one column of a text area, select the first as described above, and select further ones by first clicking Adjust and then double-clicking Select over the column.

You can't rotate text areas and text columns (they don't have rotate handles).

Some select mode actions cannot be applied to text columns. If there are any text columns selected when you perform the operation, they are deselected first. An example of this is object deletion: you can delete a text area as a whole, but not a text column from within it.

An example

Try typing the following text into Edit and loading it into Draw as an Edit file:

\! 1

\AD

\D2

\F0 Trinity.Medium 24

\L24

\P24

This is an example of a text area containing two columns. The text was prepared in Edit, and then saved directly into Draw. The columns were then stretched to the right size, using select mode, and the rectangles added.

This creates the following text area:

The appearance of a text area is determined from commands which are included in the text used to create it. Each command starts with a backslash (\) character. The full list of sequences is given below, but the following is a brief description of the commands used in the example.

Text area commands

The following is a complete list of text area commands. Some commands must be terminated with either a newline or a slash (/) character. Others do not need a terminator (for example, where the command has a fixed number of characters) but may optionally end with a slash character. For clarity, it is often useful to include it. Note especially that all commands are case sensitive: this is unusual in RISC OS and applications written for it.

In the following descriptions

Here's the full list of annotations:

Commands and their effects:

Rules for displaying text areas

Line splitting

Draw displays text in text areas by splitting it into lines and columns. When deciding where to split the text, Draw tries to split it at the space or soft hyphen that gives the most characters that will fit in the column. If this is not possible, the text is split at the character that gives the longest line that just fits in the column.

Special characters and paragraph formatting

Certain characters have special interpretations:

For columns other than the first, paragraph spacings at the head of the column are ignored. Lines which protrude vertically beyond the limits of the column are not displayed; however, all commands occurring in them are interpreted. This can occur if the line spacing is significantly smaller than the font height. You should take care (by using the \M command) to ensure that lines do not protrude beyond the limits of the column horizontally, since the text may not be displayed correctly in this case. The only circumstances in which this is likely to happen are when an italic font is used and the margin setting does not allow for it.

Font usage

When a text area is being constructed from a text file, or being loaded as part of a Draw file, checks are made on the fonts contained in it. If a font is not available, a warning message is displayed. Text that should be in this font will appear in the most recently-used font.

Exporting text from a text area

You can re-export text used to construct a text area back into a text file, by choosing Save/Text area. This can be useful for altering text areas in a Draw file, when the original text file used to create them is no longer available.

Default text area header

If the text does not start with a version number line (\! 1), Draw will insert the following standard header:

\! 1

\F 0 Trinity.Medium 12

\F 1 Corpus.Medium 12

\0

\AD

\L12

This defines two font references, sets the text to be displayed in font 0 (Trinity Medium) justified to both left and right margins, with a line spacing of 12pt. If you subsequently export the text, the standard header will be exported as well.

DXF files

Draw can read files in DXF (data interchange) format. This is a file format used by other graphics programs such as AutoSketch. Draw cannot save files in DXF format.

When you load a DXF file into Draw by dragging it into a window or onto the Draw icon, a dialogue box appears, in which you can specify:

To load the file, click on OK. If you click on Abandon, the file is not loaded.

The following restrictions apply to DXF files loaded into Draw:

JPEGs (photo-quality images)

Draw can read files in JPEG format. JPEG stands for Joint Photographic Experts Group, and is a standard format for compressing photographic images (see the pictures in the Images directory, for example).

Unlike Paint, if you load a JPEG into Draw, all the original file information is kept. This means, amongst other things, that you can save an imported image back out of Draw as a JPEG file again. It also means that if you change from one screen mode to another with more colours, you'll see an imported JPEG file at a higher quality.

When you display a DrawFile containing a JPEG object, the graphics system requires some workspace for processing the JPEG data. You can see this on your Tasks display as the dynamic area 'JPEG Workspace', and its required size depends on the width in pixels of your JPEG image.

If there is insufficient free memory to allocate this workspace, Draw displays a JPEG image as a light grey rectangle containing the message 'Not enough memory available to plot JPEG'.

Some third-party applications not updated to use the JPEG features of RISC OS 3 will correctly load a DrawFile containing a JPEG image, but display a blank box where the JPEG image should be. Other applications may fail to load such a DrawFile.

If this is a problem, use !Paint or !ChangeFSI to convert your JPEG images into sprites, and replace the JPEG images in your DrawFile with these sprites. This can produce a DrawFile of the same appearance, but using far more space on disc and in your computer's memory to store.

Working with multiple Draw files

You can work on several Draw files at the same time; simply click on the Draw icon on the icon bar to start up another Draw window.

It's easy to copy objects between Draw windows. Select the object you want to copy, move the pointer to the destination Draw window and choose Select/Copy. The selected object is copied into the new window. Alternatively you can use the Save and Save Selection menu options to drag Draw icons into new Draw windows.

If you are working with multiple Draw windows, only one window can be 'active' at a time. So, if you select an object in one window and then select an object in another window, you will nullify the selection in the first window. Additionally clicking on the Draw icon to create another Draw window also nullifies any current selection.

Saving Draw features in a Desktop boot file

You may want to change some aspects of the way new Draw windows appear. For example, a new window normally opens with the Joined line tool selected, but you may prefer to have the Select tool ready to use each time you start Draw.

You can set features of this type by setting up Draw 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 Desktop boot files on page 51.

There are several features of Draw 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. The Draw features that will be recorded when you go through this process are known as Draw$Options (see Configuring applications on page 427).

Keystroke equivalents

Many Draw operations can be carried out from the keyboard instead of the menus and mouse; when you are familiar with the application, you may find this more convenient.

In Enter mode

Actions and their keystroke equivalents:

In Select mode

Actions and their keystroke equivalents:

In Path edit mode

Actions and their keystroke equivalents:

For tool selection

Actions and their keystroke equivalents:


[1] If you turn Auto adjust off and specify a very close spacing, the grid may take some time to draw.


[2] You can't have a number greater than 8 in the Magnifier box.


[3] You can't rotate Text in System font, Text areas or imported JPEG files (they have no Rotate handle).


[4] You can't convert back to a text line, nor can you convert text in System font.


[5] You should not use Encapsulated PostScript files for printing as they do not contain page size information.


RISC OS 3.7 User Guide - 22 JAN 1997