Drawing Functions for Publications

These powerful commands are provided in OpusScript and allow you to add simple drawing functionality to your publication and fill and line functions also provided to allow you to set the width and colour of the line and the colour of the fill. This reproduces some of the drawing tools provided in the Opus Editor in a simple form for you to provide within your publication but they also have many other uses.

The line and rectangle drawing functions are ideal for creating graphs, while the ellipse and freehand drawing can be used to emphasise items during presentations or training. Line drawing can be used to reveal the path of a moving object. It is ideal for children’s activities particularly early geometry or "turtle" projects and for puzzle games such as wordsearches, hangman and dot-to-dot puzzles. It can also be used for special effects and animation. Drawing shapes can also be useful in educational packages and for animation effects.

You will need to draw a frame on the page which defines the area on which you want to draw. The co-ordinates for the drawing functions are absolute and refer to the location on the page not within the frame. This is to make them consistent with mouse position co-ordinates which will often be used in conjunction with the drawing commands. To make the frame coordinates match it will often be most useful to draw a frame which covers the entire page even if you are only drawing to a portion of it.

Note: Any effects you apply to the frame will apply to any object drawn in the frame thus you can use textures to suggest chalk style drawing or to add shading/styling to graph columns. You can also apply blends to fade the objects.

You will also need add a script object or a script action to an object on the page which contains the script for the drawing actions.

The relevant functions are:

You will also need to use the SetLineColour, SetLineStyle and SetFillColour functions to set the kind of line drawn and the fill. You will probably also want to use GetMousePosition to draw a line to the current mouse position. The details and syntax for these commands, together with examples of their use are provided in the Opus Script help and there is a sample application provided which illustrates some of the features in use.

If you want to draw composite objects you will need to have a separate frame for each object as the style of drawing tool is specific to the frame.

Frames used for drawing commands can contain other objects and/or properties. The lines or shapes drawn with the drawing script will appear over the top of the existing content of the frame.

Details of each function are provided in the OpusScript help file.

Please note that using frames which have been rotated or skewed will make it difficult to calculate the positions for drawing and so is not recommended.

To allow users to set the size and position of the object you can draw objects using the mouse-move trigger and GetMousePosition. However, you will get multiple triggers and therefore multiple instances of the object will be drawn. You can use the ClearDraw between each instance to remove the previous instance. However, ClearDraw will also erase anything else drawn on that frame. The solution is to draw these objects to a temporary frame and then copy the final position and size to the actual drawing frame. Again this is illustrated in the accompanying drawing tools sample.

You should also note that the drawing commands cannot be used on vector objects drawn using the tools in the editor, they can only be used on objects created using the drawing script commands.

The drawing commands are not compatible with Opus Flex and cannot be used in Flash publications.