Motorola POWERBOOK 100 Manuel d'utilisateur

Naviguer en ligne ou télécharger Manuel d'utilisateur pour Logiciel Motorola POWERBOOK 100. IM: Im: Basic QuickDraw Manuel d'utilisatio

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 60
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 0
CHAPTER 2
About Basic QuickDraw
2-3
2
Basic QuickDraw
Basic QuickDraw 2
This chapter describes how to initialize basic QuickDraw and how to create and manage
a
basic graphics port
—the drawing environment in which your application can create
graphics and text in either black and white or eight basic colors. Many of the routines
described in this chapter also operate in color graphics ports, and are noted as such. This
chapter also describes the mathematical foundation of both basic QuickDraw and Color
QuickDraw.
Read this chapter to learn how to set up a drawing environment for your application on
all models of Macintosh computers. The chapter “Color QuickDraw” in this book
describes additional data structures and routines necessary for preparing the more
sophisticated color drawing environments that are supported on the more powerful
Macintosh computers.
If your application ever draws to the screen, it uses basic QuickDraw—either directly, as
when it draws shapes or patterns into a window, or indirectly, as when it uses another
Macintosh Toolbox manager (such as the Window Manager or Menu Manager) to
implement elements of the standard Macintosh user interface. If your application does
not use color, or uses only a few colors, you may find that all the tools you need for
preparing a graphics environment are provided by basic QuickDraw. Once you prepare
a basic drawing environment as described in this chapter, you can begin drawing into it
as described in the next chapter, “QuickDraw Drawing.”
About Basic QuickDraw 2
Basic QuickDraw,
designed for the earliest Macintosh models with their built-in
black-and-white screens, is a collection of system software routines that your application
can use to manipulate images on all Macintosh computers.
Note
All Macintosh computers support basic QuickDraw. Only those
computers based on the Motorola 68000 processor, such as the
Macintosh Classic and PowerBook 100 computers, provide no support
for Color QuickDraw.
Basic QuickDraw performs its operations in a graphics port based on a data structure of
types
GrafPort
. (Color QuickDraw, described in the chapter “Color QuickDraw,” can
work with data structures of type
GrafPort
or
CGrafPort
, the latter offering extensive
color and grayscale facilities.)
As described in the chapter “Introduction to QuickDraw,” each graphics port has its
own local coordinate system. All fields in a graphics port are expressed in these
coordinates, and all calculations and actions that QuickDraw performs use the
local coordinate system of the current graphics port. The mathematical constructs of
this coordinate system are described next.
Vue de la page 0
1 2 3 4 5 6 ... 59 60

Résumé du contenu

Page 1 - About Basic QuickDraw 2

CHAPTER 2 About Basic QuickDraw 2-3 2 Basic QuickDrawBasic QuickDraw 2 This chapter describes how to initialize basic QuickDraw and how to create and

Page 2 - Points 2

CHAPTER 2Basic QuickDraw2-12 About Basic QuickDrawvisible region of the window in back. When you draw into the back window, whatever’s being drawn is

Page 3 - Rectangles 2

CHAPTER 2Basic QuickDrawAbout Basic QuickDraw 2-132 Basic QuickDrawAs shown in this figure, QuickDraw assigns the entire screen as the boundary rectang

Page 4

CHAPTER 2Basic QuickDraw2-14 Using Basic QuickDrawThe Limited Colors of a Basic Graphics Port 2The fgColor, bkColor, and colrBit fields contain values

Page 5 - Regions 2

CHAPTER 2Basic QuickDrawUsing Basic QuickDraw 2-152 Basic QuickDrawThese tasks are explained in greater detail in the rest of this chapter. After perf

Page 6 - CHAPTER 2

CHAPTER 2Basic QuickDraw2-16 Using Basic QuickDrawInitializing Basic QuickDraw 2Call the InitGraf procedure to initialize QuickDraw at the beginning o

Page 7 - Bitmaps 2

CHAPTER 2Basic QuickDrawUsing Basic QuickDraw 2-172 Basic QuickDrawListing 2-2 shows a simplified application-defined procedure called DoNew that uses t

Page 8 - = –60, v = –90 in

CHAPTER 2Basic QuickDraw2-18 Using Basic QuickDrawSetting the Graphics Port 2Before drawing into the window, Listing 2-2 calls the SetPort procedure t

Page 9 - About Basic QuickDraw 2-11

CHAPTER 2Basic QuickDrawUsing Basic QuickDraw 2-192 Basic QuickDrawSwitching Between Global and Local Coordinate Systems 2Each graphics port has its o

Page 10 - About Basic QuickDraw

CHAPTER 2Basic QuickDraw2-20 Using Basic QuickDrawScrolling the Pixels in the Port Rectangle 2If your application scrolls a document in a window, your

Page 11 - Text in a Graphics Port 2

CHAPTER 2Basic QuickDrawUsing Basic QuickDraw 2-212 Basic QuickDrawThe application uses the QuickDraw procedure ScrollRect to shift the pixels current

Page 12 - Using Basic QuickDraw 2

CHAPTER 2 Basic QuickDraw 2-4 About Basic QuickDraw The Mathematical Foundations of QuickDraw 2 QuickDraw defines some mathematical constructs that ar

Page 13 - 2 Basic QuickDraw

CHAPTER 2Basic QuickDraw2-22 Using Basic QuickDrawThe ScrollRect procedure takes four parameters: a rectangle to scroll, a horizontal distance to scro

Page 14 - Using Basic QuickDraw

CHAPTER 2Basic QuickDrawUsing Basic QuickDraw 2-232 Basic QuickDrawIn Figure 2-5, the application determines a vertical scrolling distance of –100, wh

Page 15 - Using Basic QuickDraw 2-17

CHAPTER 2Basic QuickDraw2-24 Using Basic QuickDrawThe left side of Figure 2-6 shows how the application uses the SetOrigin procedure to move the windo

Page 16 - Setting the Graphics Port 2

CHAPTER 2Basic QuickDrawUsing Basic QuickDraw 2-252 Basic QuickDrawHowever, the window origin of the port rectangle cannot be left at the point with a

Page 17 - Using Basic QuickDraw 2-19

CHAPTER 2Basic QuickDraw2-26 Basic QuickDraw ReferenceIMPORTANTFor optimal performance and future compatibility, you should use the SetOrigin procedur

Page 18

CHAPTER 2Basic QuickDrawBasic QuickDraw Reference 2-272 Basic QuickDrawThe bitmap (a data structure of type BitMap) defines a physical bit image in ter

Page 19 - Using Basic QuickDraw 2-21

CHAPTER 2Basic QuickDraw2-28 Basic QuickDraw ReferenceThe Rect data type can be defined by two points or four integers. The two points define the upper-

Page 20

CHAPTER 2Basic QuickDrawBasic QuickDraw Reference 2-292 Basic QuickDrawThe data structure for a region consists of two fixed-length fields followed by a

Page 21 - Using Basic QuickDraw 2-23

CHAPTER 2Basic QuickDraw2-30 Basic QuickDraw ReferenceField descriptionsbaseAddr A pointer to the beginning of the bit image.rowBytes The offset in by

Page 22

CHAPTER 2Basic QuickDrawBasic QuickDraw Reference 2-312 Basic QuickDrawSeveral fields in the GrafPort record define your application’s drawing area: all

Page 23 - Using Basic QuickDraw 2-25

CHAPTER 2 Basic QuickDrawAbout Basic QuickDraw 2-5 2 Basic QuickDraw TYPE VHSelect = (v,h); Point = RECORD CASE Integer OF0: (v: Integer: {vertica

Page 24 - Basic QuickDraw Reference 2

CHAPTER 2Basic QuickDraw2-32 Basic QuickDraw ReferenceField descriptionsdevice Device-specific information that’s used by the Font Manager to achieve t

Page 25 - Field descriptions

CHAPTER 2Basic QuickDrawBasic QuickDraw Reference 2-332 Basic QuickDrawpnLoc The point where QuickDraw will begin drawing the next line, shape, or cha

Page 26 - Region 2

CHAPTER 2Basic QuickDraw2-34 Basic QuickDraw ReferencetxMode One of three Boolean source modes that determines the way characters are placed in the bi

Page 27 - BitMap 2

CHAPTER 2Basic QuickDrawBasic QuickDraw Reference 2-352 Basic QuickDrawcolrBit The plane of the color picture to draw into when printing. As in the pr

Page 28 - GrafPort 2

CHAPTER 2Basic QuickDraw2-36 Basic QuickDraw ReferenceRoutines 2This section describes the routines for initializing basic (as well as Color) QuickDra

Page 29

CHAPTER 2Basic QuickDrawBasic QuickDraw Reference 2-372 Basic QuickDrawASSEMBLY-LANGUAGE INFORMATIONThe QuickDraw global variables are stored in rever

Page 30 - Basic QuickDraw Reference

CHAPTER 2Basic QuickDraw2-38 Basic QuickDraw Referencewindow record containing the graphics port by calling the Memory Manager procedure DisposePtr. O

Page 31

CHAPTER 2Basic QuickDrawBasic QuickDraw Reference 2-392 Basic QuickDrawSPECIAL CONSIDERATIONSThe OpenPort procedure may move or purge memory blocks in

Page 32

CHAPTER 2Basic QuickDraw2-40 Basic QuickDraw ReferenceDESCRIPTIONThe InitPort procedure reinitializes the fields of a GrafPort record that was opened w

Page 33

CHAPTER 2Basic QuickDrawBasic QuickDraw Reference 2-412 Basic QuickDrawSEE ALSOThe CloseCPort procedure (described in the chapter “Color QuickDraw”) c

Page 34 - Routines 2

CHAPTER 2 Basic QuickDraw 2-6 About Basic QuickDraw You can access a variable of type Rect either as four boundary coordinates or as two diagonally

Page 35

CHAPTER 2Basic QuickDraw2-42 Basic QuickDraw ReferenceSEE ALSOListing 2-3 on page 2-18 illustrates how to use GetPort to save the graphics port for th

Page 36 - OpenPort 2

CHAPTER 2Basic QuickDrawBasic QuickDraw Reference 2-432 Basic QuickDrawManaging Bitmaps, Port Rectangles, and Clipping Regions 2You can use the Scroll

Page 37 - InitPort 2

CHAPTER 2Basic QuickDraw2-44 Basic QuickDraw ReferenceThe empty area created by the scrolling is filled with the graphics port’s background pattern, an

Page 38 - ClosePort 2

CHAPTER 2Basic QuickDrawBasic QuickDraw Reference 2-452 Basic QuickDrawSetOrigin 2To change the coordinates of the window origin of the port rectangle

Page 39 - GetPort 2

CHAPTER 2Basic QuickDraw2-46 Basic QuickDraw ReferenceSEE ALSO“Scrolling the Pixels in the Port Rectangle” beginning on page 2-20 provides a general d

Page 40 - SetPort 2

CHAPTER 2Basic QuickDrawBasic QuickDraw Reference 2-472 Basic QuickDrawDESCRIPTIONThe MovePortTo procedure changes the position of the current graphic

Page 41 - ScrollRect 2

CHAPTER 2Basic QuickDraw2-48 Basic QuickDraw ReferenceSetClip 2To change the clipping region of the current graphics port (basic or color) to a region

Page 42 - ScrollRect(r,20,30…)

CHAPTER 2Basic QuickDrawBasic QuickDraw Reference 2-492 Basic QuickDrawClipRect 2To change the clipping region of the current graphics port (basic or

Page 43 - SetOrigin 2

CHAPTER 2Basic QuickDraw2-50 Basic QuickDraw ReferenceDESCRIPTIONThe BitMapToRegion function converts a given BitMap or PixMap record to a region. You

Page 44 - MovePortTo 2

CHAPTER 2Basic QuickDrawBasic QuickDraw Reference 2-512 Basic QuickDrawManipulating Points in Graphics Ports 2Each graphics port (basic or color) has

Page 45 - GetClip 2

CHAPTER 2 Basic QuickDrawAbout Basic QuickDraw 2-7 2 Basic QuickDraw Regions 2 The data structure for a region consists of two fixed-length fields foll

Page 46 - SetClip 2

CHAPTER 2Basic QuickDraw2-52 Basic QuickDraw ReferenceLocalToGlobal 2To convert a point’s coordinates from the local coordinates of the current graphi

Page 47 - BitMapToRegion 2

CHAPTER 2Basic QuickDrawBasic QuickDraw Reference 2-532 Basic QuickDrawSubPt 2To subtract the coordinates of one point from another, you can use the S

Page 48 - SetPortBits 2

CHAPTER 2Basic QuickDraw2-54 Basic QuickDraw ReferenceSetPt 2To assign two coordinates to a point, use the SetPt procedure.PROCEDURE SetPt (VAR pt: P

Page 49 - GlobalToLocal 2

CHAPTER 2Basic QuickDrawBasic QuickDraw Reference 2-552 Basic QuickDrawDESCRIPTIONThe GetPixel function examines the pixel at the point specified by th

Page 50 - LocalToGlobal 2

CHAPTER 2Basic QuickDraw2-56 Summary of Basic QuickDrawSummary of Basic QuickDraw 2Pascal Summary 2Data Types 2TYPE Point = RECORD CASE Integer OF0: (

Page 51 - DeltaPoint 2

CHAPTER 2Basic QuickDrawSummary of Basic QuickDraw 2-572 Basic QuickDrawGrafPtr = ^GrafPort;WindowPtr = GrafPtr;GrafPort = {basic graphics port}RECORD

Page 52 - GetPixel 2

CHAPTER 2Basic QuickDraw2-58 Summary of Basic QuickDrawSaving and Restoring Graphics PortsPROCEDURE GetPort (VAR port: GrafPtr);PROCEDURE SetPort (por

Page 53

CHAPTER 2Basic QuickDrawSummary of Basic QuickDraw 2-592 Basic QuickDrawstruct Rect {short top; /* upper boundary of rectangle */short left; /* left b

Page 54 - Summary of Basic QuickDraw 2

CHAPTER 2Basic QuickDraw2-60 Summary of Basic QuickDrawshort patStretch; /* used internally */Handle picSave; /* picture being saved, used internally

Page 55 - Initializing QuickDraw

CHAPTER 2Basic QuickDrawSummary of Basic QuickDraw 2-612 Basic QuickDrawManipulating Points in Graphics Portspascal void GlobalToLocal (Point *pt);pas

Page 56 - C Summary 2

CHAPTER 2 Basic QuickDraw 2-8 About Basic QuickDraw The GrafPort record is diagrammed in Figure 2-1. Some aspects of its contents are discussed aft

Page 57

CHAPTER 2Basic QuickDraw2-62 Summary of Basic QuickDrawGrafPort Data StructureGlobal Variables 2Result Codes 20 device word device-specific information

Page 58 - Functions 2

CHAPTER 2 Basic QuickDrawAbout Basic QuickDraw 2-9 2 Basic QuickDraw Bitmaps 2 The portBits field of a GrafPort record contains the bitmap, a da

Page 59 - Assembly-Language Summary 2

CHAPTER 2 Basic QuickDraw 2-10 About Basic QuickDraw The rowBytes field of the bitmap contains the width of a row of the image in bytes. A bitmap mu

Page 60 - Result Codes 2

CHAPTER 2Basic QuickDrawAbout Basic QuickDraw 2-112 Basic QuickDrawBy default, QuickDraw assigns the entire main screen as the boundary rectangle for

Commentaires sur ces manuels

Pas de commentaire