background image
C H A P T E R 1 3
Drawing and Graphics
13-10
Using the Drawing Interface
If you want to redraw a view explicitly at any particular time, you need to send it
the
Dirty
message. This message causes the system to add that view to the area of
the screen that it updates in the next event loop cycle. To make the update area
redraw before the next event loop cycle, you must call the
RefreshViews
function after sending the
Dirty
message.
Drawing Immediately
13
If you want to draw in a view at times other than when the view is being opened
or redrawn automatically, you can execute drawing code outside of the
ViewDrawScript
method by using
DoDrawing
. For example, you might need
to perform your own drawing operations immediately when the user taps in the view.
You can use the
DoDrawing
method for this purpose. The
DoDrawing
method
calls another drawing method that you supply as one of its arguments.
W A R N I N G
Do not directly use
DrawShape
to draw shapes outside
of your
ViewDrawScript
. Standard drawing in
ViewDrawScript
and
DoDrawing
automatically set
up the drawing environment. If you use
DrawShape
without
setting up the drawing environment, your application could
accidentally draw on top of other applications, keyboards,
or floaters.
Using Nested Arrays of Shapes
13
The
DrawShape
method can draw multiple shapes when passed an array of shapes
as its argument. Style frames may be included in the shape array to change the
drawing style used to image subsequent elements of the array. Each element of
the array can itself be an array as well; this section refers to such an array as a
nested array.
Styles are maintained on a per-array basis in nested arrays, and the startStyle
parameter of
DrawShape
is always treated as though it were the first array
element of the topmost array. Therefore, compound shapes and multiple styles
remain intact when nested arrays are combined into larger groupings.
When the
DrawShape
method processes a nested array, the shapes are drawn in
ascending element order and drawing begins with the style of the parent array.
Although the drawing style may change while processing the elements of an
individual array, that style applies only to the elements of that particular array.
Therefore, if an array happens to be an element of another array--that is, a nested
array--style changes in the nested array affect the processing of its subsequent
elements but the drawing style of the parent array is restored after the last element
of the nested array is processed.
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна