2.1.27.18 IntersectRect
Description
Calculates the intersection of two source rectangles and places the coordinates of the intersection rectangle into the destination rectangle.
Syntax
BOOL IntersectRect( RECT * lprDst, const RECT * lprcSrc1, const RECT * lprcSrc2 )
Parameters
- lprDst
- [output] pointer to a RECT structure to receive the result
- lprcSrc1
- [input] first source RECT
- lprcSrc2
- [input] second source RECT
Return
If the rectangles intersect, returns TRUE.
If the rectangles do not intersect, returns FALSE.
Examples
EX1
void IntersectRect_Ex1()
{
RECT recA = {10,20,40,50};
RECT recB = {20,30,70,80};
RECT rec ;
if(IntersectRect(&rec,&recA,&recB))
{
printf("Intersection between recA and recB is:\n");
printf("left:%d top:%d right:%d bottom: %d\n",rec.left,rec.top,rec.right,rec.bottom);
}
else
printf("recA and recB has no intersection\n");
}
Remark
Calculates the intersection of two source rectangles and places the coordinates of the intersection rectangle into the destination rectangle.
If the source rectangles do not intersect, an empty rectangle (in which all coordinates are set to zero) is placed into the destination rectangle.
See Also
Header to Include
origin.h
Reference
|