Apple Newton Utilities Guide de l'utilisateur Page 539

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 942
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 538
CHAPTER 13
Drawing and Graphics
Using the Drawing Interface 13-13
If the style frame includes a clipping slot, the drawing of all shapes affected by
this style frame is clipped according to the value of the
clipping slot. If the
value of the
clipping slot is nil or if the clipping slot is not supplied, the
clipping behavior of the destination view is used.
If the
clipping slot contains a region shape, that region is used as the clipping
boundary for drawing operations affected by this style frame. If the
clipping slot
contains an array of shapes or regions, the system passes the contents of the
clipping slot to the MakeRegion function to automatically create a new
clipping region from the contents of this slot.
Note
Although putting an array of shapes in the clipping slot may
seem convenient, it signicantly increases the time required to
process the style frame. For best performance from the view
system, do not use this shortcut in style frames that are used
repeatedly.
Tran sforming a Shape 13
The transform slot changes the size or location of a shape without altering the
shape itself. It accepts an array specifying an
x, y coordinate pair or a pair of
rectangles. The
x, y coordinate arguments relocate a shape by specifying an offset
from the origin of the destination view’s coordinate plane. The rectangle arguments
specify a mapping of the source and destination views that alters both the size and
location (offset) of the source view when it is drawn in the destination view.
The rectangle arguments work the same way as the parameters to the
ScaleShape function (although transforms won’t accept nil for the boundaries
of the source rectangle): the size of the shape is changed proportionately according
to the dimensions of the destination rectangle, and the coordinates of the
destination rectangle can also be used to draw the shape in a new location.
The following code fragments demonstrate the use of offset coordinates and
mapping rectangles as the value of the
transform slot:
transform: [30,50],// offset shapes by 30 h and 50 v
or
transform:
[SetBounds(0,0,100,100),SetBounds(25,25,75,75)],
// half width and height, centered in relation to
// the original object(not the view) assuming that
// the first rect actually specified correct bounds
Vue de la page 538
1 2 ... 534 535 536 537 538 539 540 541 542 543 544 ... 941 942

Commentaires sur ces manuels

Pas de commentaire