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 3 - QuickDraw Drawing / QuickDraw Drawing Reference
Routines / Creating and Managing Rectangles


To determine whether two rectangles intersect, you can use the SectRect function.

FUNCTION SectRect (src1,src2:\xDDRect; VAR dstRect: Rect): Boolean;
The first of two rectangles to test for intersection.
The second of two rectangles to test for intersection.
The rectangle marking the intersection of the first two rectangles.
The SectRect function calculates the rectangle that delineates the intersection of the two rectangles you specify in the src1 and src2 parameters. The SectRect function returns the area of intersection in the dstRect parameter and a function result of TRUE if they intersect or FALSE if they don't. Rectangles that touch at a line or a point are not considered intersecting, because their intersection rectangle (actually, in this case, an intersection line or point) doesn't enclose any pixels in the bit image.

If the rectangles don't intersect, the destination rectangle is set to (0,0,0,0). The SectRect procedure works correctly even if one of the source rectangles is also the destination.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996