background image
C H A P T E R 1 3
Drawing and Graphics
Using the Drawing Interface
Changes to View Classes
slot of a view of the
class can now contain a graphic
shape, in addition to bitmap or picture objects.
Using the Drawing Interface
This section describes how to use the drawing interface to perform specific tasks.
See "Drawing and Graphics Reference" (page 10-1) in the Newton Programmer's
for descriptions of the functions and methods discussed in this section.
How to Draw
Drawing on the Newton screen is a two-part process. You first create a shape object
by calling one or more graphics functions, such as
, and so
on. You then draw the shape object by passing any of the shapes returned by the
shape-creation functions, or an array of such shapes optionally intermixed with
style frames to the
method. If a style frame is included in the shape
array, it applies to all subsequent shapes in the array, until overridden by another
style frame.
In addition to the shape object, the
method accepts a style frame
parameter. The style frame specifies certain characteristics to use when drawing the
shape, such as pen size, pen pattern, fill pattern, transfer mode, and so on.
This system is versatile because it separates the shapes from the styles with which
they are drawn. You can create a single shape and then easily draw it using different
styles at different times.
can also accept as its argument an array of shapes instead of just a
single shape. Therefore, you can create a series of shapes and draw them all at once
with a single call to the
method. Additional style frames can be
included in the shape array to change the drawing style for the shapes that follow
them. "Using Nested Arrays of Shapes" (page 13-10), discusses the use of arrays of
shapes in more detail.
Responding to the ViewDrawScript Message
When the system draws a view, it sends a
message to the view.
To perform your own drawing operations at this time, you must provide a
method that calls the appropriate drawing functions.
The system also sends the
message to the view whenever it is
redrawn. Views may be redrawn as the result of a system notification or a user action.
© 2007-2017, o7 studio » при воспроизведении материала сайта ссылка обязательна