beautypg.com

Apple Newton Programmer’s Newton 2.0 (for Newton 2.0) User Manual

Page 537

background image

C H A P T E R 1 3

Drawing and Graphics

Using the Drawing Interface

13-11

For example, you might nest arrays to create the hierarchy of shapes and styles
depicted in Figure 13-9.

Figure 13-9

Example of nested shape arrays

If the nested shape array depicted in Figure 13-9 were passed to the

DrawShape

function, the results summarized in Table 13-1 would occur.

The Transform Slot in Nested Shape Arrays

13

Within a single shape array, the

transform

slot is treated like a style frame: only

one transform is active per array; if another transform is specified within the array,
the previous transform is overridden. Within nested arrays, however, the

transform

slot is treated a little differently than most style slots. As the

DrawShape

method

descends into nested arrays of shapes, changes to the

transform

slot are

cumulative; the resulting transform is the net sum of all the transforms in the
hierarchy. For example, if in Figure 13-9

startStyle

has a transform of 10,10 and

Style 3 has a transform 50,0 then shapes 2a, 2b, 1, 3a would be drawn offset by
10,10 but Shape 3b would be drawn offset by 60,10.

Table 13-1

Summary of drawing results

Shape

Style

2a

2

2b

2

3a

startStyle

3b

3

1

startStyle

Style 2

Shape 3a

Shape 2a

Style 3

Shape 2b

Shape 3b

Start Style

Shape 1