background image
C H A P T E R 1 3
Drawing and Graphics
Using the Drawing Interface
13-9
Changes to View Classes
13
The
icon
slot of a view of the
clPictureView
class can now contain a graphic
shape, in addition to bitmap or picture objects.
Using the Drawing Interface
13
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
Reference
for descriptions of the functions and methods discussed in this section.
How to Draw
13
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
MakeRect
,
MakeLine
, 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
DrawShape
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
DrawShape
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.
DrawShape
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
DrawShape
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
13
When the system draws a view, it sends a
ViewDrawScript
message to the view.
To perform your own drawing operations at this time, you must provide a
ViewDrawScript
method that calls the appropriate drawing functions.
The system also sends the
ViewDrawScript
message to the view whenever it is
redrawn. Views may be redrawn as the result of a system notification or a user action.
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна