Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Imaging With QuickDraw /
Chapter 5 - Graphics Devices / Graphics Devices Reference
Routines for Graphics Devices / Determining the Characteristics of a Video Device


DeviceLoop

For drawing images that are optimized for every screen they cross, use the DeviceLoop procedure.

PROCEDURE DeviceLoop (drawingRgn: RgnHandle; 
                     drawingProc: DeviceLoopDrawingProcPtr; 
                     userData: LongInt; flags: DeviceLoopFlags);
drawingRgn
A handle to the region in which you will draw; this drawing region uses coordinates that are local to its graphics port.
drawingProc
A pointer to your own drawing procedure.
userData
Any additional data that you wish to supply to your drawing procedure.
flags
One or more members of the set of flags defined by the DeviceLoopFlags data type:
           TYPE
              DeviceLoopFlags = SET OF 
              (singleDevices,dontMatchSeeds,allDevices);
These flags are described in the following text; if you want to use the default behavior of DeviceLoop, specify an empty set ([]) in this parameter.
DESCRIPTION
The DeviceLoop procedure searches for graphics devices that intersect your window's drawing region, and it calls your drawing procedure for each video device it finds. In the drawingRgn parameter, supply a handle to the region in which you wish to draw; in the drawingProc parameter, supply a pointer to your drawing procedure. In the flags parameter, you can specify members of the set of these flags defined by the DeviceLoopFlags data type:
singleDevicesIf this flag is not set, DeviceLoop calls your drawing procedure only once for each set of similar graphics devices, and the first one found is passed as the target device. (It is assumed to be representative of all the similar graphics devices.) If you set the singleDevices flag, then DeviceLoop does not group similar graphics devices--that is, those having identical pixel depths, black-and-white or color settings, and matching color table seeds--when it calls your drawing procedure.
dontMatchSeedsIf you set the dontMatchSeeds flag, then DeviceLoop doesn't consider the ctSeed field of ColorTable records for graphics devices when comparing them; DeviceLoop ignores this flag if you set the singleDevices flag.
allDevicesIf you set the allDevices flag, DeviceLoop ignores the drawingRgn parameter and calls your drawing procedure for every device. The value of current graphics port's visRgn field is not affected when you set this flag.

For each dissimilar video device that intersects this region, DeviceLoop calls your drawing procedure. For example, after a call to the Event Manager procedure BeginUpdate, the region you specify in the drawingRgn parameter can be the same as the visible region for the active window. Because DeviceLoop provides your drawing procedure with the pixel depth and other attributes of each video device, your drawing procedure can optimize its drawing for each video device--for example, by using the HiliteColor procedure to set magenta as the highlight color on a color video device.

SPECIAL CONSIDERATIONS
The DeviceLoop procedure may move or purge memory blocks in the application heap. Your application should not call this procedure at interrupt time.

SEE ALSO
Listing 5-1 on page 5-7 illustrates the use of DeviceLoop. See page 5-34 for a description of the drawing procedure you must provide for the drawingProc parameter. Offscreen graphics worlds are described in the next chapter. The HiliteColor procedure is described in the chapter "Color QuickDraw" in this book.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996