Compo Scripts

This page contains a selection of scripts suitable for use with the RISC OS graphics program Compo.

They've all been tested on the latest version of Compo (1.23c), so if you experience any problems, first ensure that you are running this latest version.

Contents

Scripts and Scriptlets

Items shown with a Text file icon are basic scripts that should be run by dragging them onto Compo's canvas.

Items shown with their own icon are scriptlets, which once installed will show up (with their own icon) in Compo's scriptlet buttonbar, from where they can be run with a single mouse click. Installing a scriptlet is simply a matter of merging the supplied sprites with the !Compo.Resources.Scripts.!!CSIcon sprite file, and saving the script file in the same directory (!Compo.Resources.Scripts). You can of course make use of a scriplet's script file in the usual way without installing it as a scriptlet.

Some of these scripts make use of a shared resource !CompoBits. This is included where needed. If you already have a copy of !CompoBits, you can just copy any downloaded version over your current version to merge in any new elements.

I document my scriptlets within the script file itself – they can easily be loaded into a text editor from Compo's main window by Ctrl-clicking on their scriptlet button.

Align Marks

AuthorJim Lesurf
Released29 May 2002
Targetsingle selected object
Download4kB Zip archive
AlignMarks icon

This aids stitching together two photographic images (for creating panoramic views, etc).

When first run, it places two cross-hair marks on the canvas. Subsequent runs will move a single selected (and uniquely named) object relatively according to the difference in position of these two marks. Ie the marks need to be positioned on the two images at points that correspond and are to be aligned (pulled together).

A full description of this script appeared in Archive magazine 14.5 p79.

Align Text

AuthorLenny
Released19 Sep 2002
Targetcurrent selection
Download2kB Zip archive

Compo 1.21f (or later) required !

Earlier versions had a Composcript bug re calculation of the baseline for text objects.
AlignText icon

Aligns selected text objects (irrespective of border sizes, ie the edges/baselines of the text are aligned).

5 options : 3 types of horizontal alignment (Left, Centre, and Right), along with 2 types of vertical alignment (Base Align and Vertical Spread).

The first 3 are standard fare. Base Align ensures objects share a common baseline, whereas Vertical Spread uses the vertical spacing between the first 2 objects, and spreads the following similarly (according to baseline, not object border) – great for web based GIFed-text menus.

Totally generic - there can be other objects on the canvas, but only those selected will be processed, and then only those that are text objects.

Colour Swap

AuthorJim Lesurf
Released27 May 2002
Targetselection
Download4kB Zip archive
Text file icon

This swaps the red and blue colour components of each selected object. The process can thus be reversed by repeating the operation.

It calls a C program (source included).

Compo to JPEG

AuthorNico ter Harr
Released21 Sep 2002
Targetcanvas
Download2kB Zip archive
Text file icon

Convert Compo files (ie the entire canvas) to non-progressive JPEG files, either individually or as a batch process on a directory of Compo files.

The JPEG quality setting is user specified. When batch processing, the same setting is used for all files.

Diffuse Shadow

AuthorLenny
Released19 Sep 2002
Targetcurrent selection
Download3kB Zip archive
DiffuseShadow icon

Adds a diffuse shadow to all selected objects. Multiple options providing four shadow types (some work better with thin text, others with chunky text), and allowing the grey level to be specified.

Totally generic - only selected objects will be processed.

A versatile, though precisely repeatable shadow effect is handy as whenever you edit a text object (spelling, colour, or whatever) any shadow reverts to a solid one. Simply cured – just re-apply using the same parameters as before.

Framer

AuthorJim Lesurf
Released29 May 2002
Targetprimary selected object
Download6kB Zip archive
Framer icon

Clips and adds a frame to the primary selected (bitmap) object – generally (though not always) the back-most object if more than one is selected.

As supplied, it offers a choice of three shapes : Circle, Rings or Rounded Rectangle. See this example image.

A full description of this script appeared in Archive magazine 13.12 p66.

GIF It

AuthorLenny
Released19 Sep 2002
Targetcurrent selection
Download2kB Zip archive
GifIt icon

Outputs all selected objects as (non-interlaced) GIFs.

Uses !InterGif, which thus needs to have been seen.

You can specify no mask, black is mask, or white is mask.

Sorry if the mask options seem limited, though I can't see how to determine which index number a particular colour will end up as when reducing from 24-bit colour to 256 colours (other than by using a known palette, eg the standard RISC OS 256 colour palette, which is the approach used here).

Glow

AuthorLenny
Released22 Oct 2003
Targetsingle selected object
Download2kB Zip archive
Glow icon

Creates a neon-like glow around a single selected object.

There are four options - Halo and Haze each create a copy of the selected object, this copy being the glow object which is then placed behind the original object. The remaining two options allow additional effect to be applied without creating a copy (ie they should be applied to an already created and selected glow object).

Initially the glow is yellow, though this can be changed by selecting the glow object (not the front object), and then using the colour picker in the Tint dialog window. This allows considerable variation - from warm glows to icy mists.

Although originally intended to be used with text objects, it can also be used with rectangular (ie un-masked) images (see example image).

Currently this can only operate on a single selected object (because it makes a copy of the object and needs to select that in isolation, which would thus lose any general selection).

This version has been modified slightly so that it works okay with Compo 1.22f or later. Specifically, it can now cope with vector layer objects (including AOIs) on the canvas.

Light Square

AuthorJim Lesurf
Released27 May 2002
Targetselection
Download3kB Zip archive
Text file icon

This lightens the central portion of all selected (bitmap) objects.

It calls a C program (source included).

A full description of this script appeared in Archive magazine 14.11 p41.

Perspective

AuthorJim Lesurf
Released04 Jul 2002
Targetprimary selected object
Download7kB Zip archive
Text file icon

This applies a perspective rotation and shading to a copy of the primary selected (bitmap) object – generally (though not always) the back-most object if more than one is selected.

It calls a C program (source included).

Plot Blank

AuthorJim Lesurf
Released27 May 2002
Targetnone
Download4kB Zip archive
Text file icon

This demonstrates a technique rather than providing a specific function. It demonstrates how to draw or paint into an object from a program called via CompoScript.

To get it to do what you want, you will need to modify and recompile the C source program (included). Though you could, of course, use the same principles in (eg) a BASIC program.

Other Compo resources

Compo @ Iconbar The official Compo website. Source of the latest version of Compo, along with documentation and examples. Maintained by the program's author, Rob Davison.
Compo Clues CompoScript tutorials with example scripts, along with details of Compo's preferences file. Maintained by Jim Lesurf.

Jim has also written a series of Compo Clues articles for Archive magazine, appearing in the following issues :

13.11  p19 : A quick run through some Compo basics - Web graphics, textured backgrounds, layers, and transparency.

13.12  p66 : The Framer script (how it's done manually).

14.2  p25 : PCA tools. CompoScript introduction.

14.4  p75 : Creating presentations using CompoScript.

14.5  p79 : The AlignMarks script explained.

14.11  p41 : New features introduced in Compo 1.21. The LightSquare script explained, including a prototype written entirely in CompoScript.

Compo mailing list A low volume maillist providing a question and answer forum for Compo users.

To subscribe, follow the link to the YahooGroups website, or send a blank email to riscomposition-subscribe@yahoogroups.com.

PCA-2 specification Programmer level detail of the PlugIn Client Application protocol, as used by Compo (and Rob's other major RISC OS applicaion Variations).

Finally, although not Compo specific, here are a couple of sources of background tiled-texture images, provided by Chris Terran and Dacha.