background image
C H A P T E R 1 3
Drawing and Graphics
About Drawing
13-7
can draw something that was defined in another program, with great flexibility and
without having to know any details about what's being drawn. Figure 13-8 shows
an example of a picture containing a rectangle, an oval, and a triangle.
Figure 13-8
A simple picture
Manipulating Shapes
13
In addition to drawing shapes, you can perform operations on them. You can
offset shapes; that is, change the location of the origin of the shape's coordinate
plane, causing the shape to be drawn in a different location on the screen. Note
that offsetting a shape modifies it; for example, the offset shape will have
different
viewBounds
values than the original shape.
scale shapes; that is, draw the shape to fill a destination rectangle of a specified
size. The destination rectangle can be larger, smaller, or the same size as the
original shape. Note that scaling a shape modifies it; for example, the scaled
shape has different
viewBounds
values than the original shape.
hit-test shapes to determine whether a pen event occurred within the boundaries
of the shape. This operation is useful for implementing button-like behavior in
any shape.
The Style Frame
13
Any shape can optionally specify characteristics that affect the way it is imaged,
such as the size of the pen or the fill pattern to be used. These characteristics are
specified by the values of slots in a style frame associated with the shape. If the
value of the style frame is
nil
, the view system draws the shape using default
values for these drawing characteristics. See "Style Frame" (page 10-1) in the
Newton Programmer's Reference
for complete details.
© 2007-2017, o7 studio » при воспроизведении материала сайта ссылка обязательна