Draw image, Move image, Erase image action

Draw image loads and draws an image file (PNG, JPEG or GIF) onto a CTC panel. Other graphics files may be supported dependant upon capabilities of your java implementation. For example my Java on Mac OS X supports: BMP, WBMP, JPG, GIF, PNG

Move image moves an existing image to a new location on the CTC panel.

Erase image removes an image from the screen.

action = drawaction | moveaction | eraseaction

Explanation of syntax definition rules

Syntax of Draw image

drawaction = [result '='] drawcmd location "=" filename [index] [size] [rotate]

drawcmd = '$DRAW IMAGE' | 'DRAW IMAGE' | '$DRAWIMAGE' | 'DRAWIMAGE'

result = variable
location = '(' column ',' row ',' panel ')'
column = varNum		// x position numbered from 1
row = varNum		// y position numbered from 1
panel = varNum		// CTC panel 1..4

filename = <string>	// such as "signal.jpg"
index = '[' varNum ']'	// cell in block containing cell specified
size = ( 'SIZE' | 'FILL' ) columns [ '*' rows ]
rotate = 'ROTATE' angle	// degrees counterclockwise

columns = varNum
rows = varNum
angle = varNum

varNum = <variable> |  <number>

If size is not specified then a single square is used.

If rows is not specified then rows = columns.

If 'SIZE' is used then the image scales while maintaining proportions.

If 'FILL' is used then the image expands to fill the specified space.

If result is specified then an image number is stored. See move image.

Syntax of Move Image

moveaction = movecmd source '->' [location] [index] [rotate]

movecmd = '$MOVE IMAGE' | 'MOVE IMAGE' | '$MOVEIMAGE' | 'MOVEIMAGE'

source = ( location | sourceVar )
sourceVar = variable

If sourceVar is specified then it should be a result assigned from a drawimage action. An image may be moved several times in this way.

If a destination location is specified, but no index then the image is moved to the specified location.

If both destination index and location are specified then the image is moved to the index-th cell in the block that the destination location is in.

If a destination index is specified but no destination location then the image is moved to the index-th cell in the block that the image is currently in.

If neither destination location or index are specified then the image remains where it is (but may just be rotated).

If a rotation is specified then the image is rotated to the specified angle. Note it is rotated to the specified angle and not by that angle.

It is an error to specify a source location not containing an image, or a source variable not containing an image reference assigned by a drawimage action, or to specify a destination with invalid co-ordinates. These errors produce messages in the log window.

Syntax of Erase Image

eraseaction = erasecmd source

erasecmd = '$ERASE IMAGE' | 'ERASE IMAGE' | '$ERASEIMAGE' | 'ERASEIMAGE'

Syntax definition rules

Each 'symbol' being defined is made up of several other symbols possibly with alternates and options. Symbols are either terminal (text actually appearing in the script), or non-terminal (symbol defined by another rule).

Each non-terminal is written plain. So non-terminal "fred" is written: fred.

Each literal terminal (constant text) is written using single quotes: 'text that must appear in script'.

Each variable terminal (such as filenames or numbers) is quoted with angle brackets. So a filename might appear as <filename>

Sequences

If a non-terminal is made up of a sequence of other symbols they are written in order, thus:

location = '(' x ',' y ',' z ')'
means that (non-terminal) symbol location is composed of an open parenthesis, another symbols called 'x', a comma, another symbol called 'y' and so on.

Alternatives

If a symbol can be made up of one of several alternatives it is written thus:
operator = '+' | '-' | '*' | '/'
The vertical bar means 'OR' and the set of options is delimited by parentheses. So an operator is defined here as being a plus sign, a minus sign, an asterisk (for multiply), or a slash (for divide).

Optional

If a symbol is optional it is surrounded by square brackets "[" and "]". Thus the following are both equivalent:
optValue = [ value ]
and
optValue = ( value | )
Where the second signifies that optValue can take either of two values, one is a 'value' and the other is nothing.

Last updated 12 Oct 2007

© Howard Amos 2005-2007