Important: The information in this document is obsolete and should not be used for new development.
SectRect
To determine whether two rectangles intersect, you can use theSectRect
function.
FUNCTION SectRect (src1,src2:\xDDRect; VAR dstRect: Rect): Boolean;
src1
- The first of two rectangles to test for intersection.
src2
- The second of two rectangles to test for intersection.
dstRect
- The rectangle marking the intersection of the first two rectangles.
DESCRIPTION
TheSectRect
function calculates the rectangle that delineates the intersection of the two rectangles you specify in thesrc1
andsrc2
parameters. TheSectRect
function returns the area of intersection in thedstRect
parameter and a function result ofTRUE
if they intersect orFALSE
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.