The eutodraw system, part 2.

William Overington

Copyright 2000 William Overington

An action code of 5 is a draw a rounded corner rectangle command. This is somewhat different as two columns to the right are needed. The first column to the right is as for the rectangle above. The second column to the right is the distance from the corners that rounding starts to occur, in both the x and y directions.

For example, adapting the rectangle above.

$Z $P 200 &w $X 100 &w $Y 506 &w $C 50 &w $X 40 &w $Y !-2 &w $C $P 5&w $X 5 &w $Y !-2 &w $C $E

x

200

50

5

y

100

40

5

c

506

-2

-2

 

An action code of 6 is a draw a filled rounded cornered rectangle command. This is similar to the above.

x

200

50

5

y

100

40

5

c

606

-2

-2

 

An action code of 7 is used to draw arcs. Two columns to the right are needed.

The first column gives the top left corner of a rectangle, the second column the width and height of the rectangle. The rectangle is not drawn but is useful for envisaging the construction. The centre of the rectangle is found. This is not drawn either.

The third column gives two angles, the start angle and the arc angle. The start angle is stored in the x row and the arcangle in the y row, though that is for the convenience of placing these details into the eutodraw table. The angles are not related to x and y coordinates as such. These two angles are in degrees. This use of degrees in this situation is as used in the underlying Java functions of drawArc and fillArc, which each have six parameters. In the underlying Java, lines, rectangles and arcs and so on are drawn in the colour that is the present drawing colour, which is set using the setColor function. The 1456 engine software interpreting eutodraw table instructions for drawing lines, rectangles, ovals and arcs into Java commands in fact uses a setColor function to set the colour and then uses the appropriate function with the rest of the parameters.

Returning to the matter of angles, consider that an arc is being drawn where the width and the height of the rectangle have the same value, that is the rectangle is also a square, and the arc is the arc of a circle. For the start angle, zero degrees is at the rightmost point of the construction circle, that is, at the 3 o'clock position, if the circle were a clock face. The start angle is measured in degrees anticlockwise. So starting at 12 o'clock needs a start angle of 90 degrees, starting at 11 o'clock needs a start angle of 120 degrees, and so on. This start at 3 o'clock and measuring in an anticlockwise direction fits in well with conventional mathematical nomenclature for drawing of polar graphs, so fits in well with conventional usage.

The arc angle is also measured in degrees and is also measured in an anticlockwise direction. The arc angle is the length of the arc in degrees. So, if an arc is to travel from 2 o'clock in an anticlockwise direction to 8 o'clock, then the start angle is 30 degrees and the arc angle is 180 degrees. If an arc is to travel in a clockwise direction from 2 o'clock to 8 o'clock, then it must be regarded as an arc travelling in an anticlockwise direction from 8 o'clock to 2 o'clock and thus the start angle is 210 degrees and the arc angle is 180 degrees. It is perfectly alright that this puts the end of the arc at 390 degrees (390 = 210 + 180) as that is interpreted just as if it were 30 degrees (30 = 390 - 360).

x

200

50

30

y

100

40

105

c

706

-2

-2

 

An action code of 8 is used to draw filled arcs. The filling is of a shape defined by the arc and two lines, each line drawn from an end of the arc to the centre of the original construction rectangle. Thus, several filled arcs may be used to draw a complete pie chart if so desired.

x

200

50

30

y

100

40

105

c

806

-2

-2

 

An action code of 21 will draw a polygon of up to 20 sides. The eutodraw system looks forward for the x and y coordinates of the polygon and will include a point for each column until a column with a -3 as the control code is reached. The column with the -3 is included in the polygon.

The points below define a quadrilateral with the points (200,100) (300,170) (200,200) (100,150) drawn in the colour blue.

x

200

300

200

100

y

100

170

200

150

c

2106

-2

-2

-3

 

Here is the 1456 object code.

$Z

$P 200 &w $X 100 &w $Y 2106 &w $C

$P 300 &w $X 170 &w $Y !-2 &w $C

$P 200 &w $X 200 &w $Y !-2 &w $C

$P 100 &w $X 150 &w $Y !-3 &w $C

$E

An action code of 22 will draw a filled polygon. The rules are otherwise the same as for an unfilled polygon.

x

200

300

200

100

y

100

170

200

150

c

2206

-2

-2

-3

 

An action code of 31 will draw the value of the contents of ad1456 at the stated (x,y) coordinates in the chosen colour.

x

100

y

100

c

3106

 

The 1456 object code is as follows.

$Z 100 &w $X 100 &w $Y 3106 &w $C $E

Note that here all of the information to generate the output is not within the eutodraw table.

Action codes of 51 to 59 output strings that can be optionally included in the input in the param commands. An action subcode is generated from the second digit of the action code. Thus 57 would give an action subcode of 7.

x

100

y

200

c

5702

 

For example.

$Z $P 100 &w $X 200 &w $Y 5702 &w $C $E

will output at location (100,200) in red the text Strawberry defined in the applet call by the following.

<param name="STRING07" value="Strawberry">

STRING01 through to STRING09 are available for use in this manner if so desired. None, some or all of them may be defined, yet should not be defined as null strings. That is, if they are defined in the applet call, they should contain at least one character.

An action code of 91 is used to allow use of the Java clearRect function, that is the clearing of a rectangle by filling it with the background colour. The code of 9100 is entered in the table as the control number. The inclusion of this command may possibly seem to be unnecessary as the colour to be used could be signaled in the control number for a filled rectangle. However, it has been added for completeness so that 1456 object code developed for one applet landscape may be ported to another applet landscape, even if the two applet landscapes are supplied with different background colours, as they may well be so supplied. Usage is similar to the usage of filled rectangle above, except for the use of the 9100 control code.

x

200

50

y

100

40

c

9100

-2

 

An action code of 92 is used to allow use of the Java clipRect function. Please note that clipRect only remains valid for the present event response in which it is used.

x

200

80

y

100

60

c

9200

-2

 

An action code of 93 is used to allow use of the Java copyArea function. The third column contains valyes of dx and dy, the distance in pixels that the area is to be copied. Please note that if a clipRect has been used, the clipRect affects only the depositing of the copied area, not the picking up of the source area which is to be copied.

x

200

30

2

y

100

20

0

c

9300

-2

-2

 

The eutodraw system has a facility for using custom colours. Colours 98 and 99 may be defined from within a 1456 program.

A colour is created using $r $g $b and $c commands. A sequence such as

192&w$r255&w$g128&w$b99&w$c

would create colour 99 as having red 192, green 255 and blue 128. Colours are defined using red, green and blue values in the range 0 to 255. Colours are stored internally in the 1456 Engine and so a colour may be used as often as desired once defined. Defining a colour, using it, redefining it and then reusing it does not alter the colour appearing on screen after the earlier usage.

The $r, $g, $b commands use the value in the ai1456 register at the time that the $r, $g, $b commands are used, so values may be from the results of calculations if so desired.

There are some other codes associated with the eutodraw system which can be useful on special occasions.

The $U command causes the eutodraw table to be reset but with the first column copied from the last column of the previous use of the eutodraw table. The use of the $U command automatically includes the equivalent of a $Z and a $P command within it as well as the placing of the data values.

The $V command is as the $U command except that the first c value is set as -1.

The $Q command allows one to move backwards in the eutodraw table. For example, suppose that one wishes to place the same value of x in two consecutive columns before placing y in the first of the two columns. The sequence $X$P$X$Q allows this to be achieved.

1456 object code

Copyright 2000 William Overington