Important: The information in this document is obsolete and should not be used for new development.
Creating and Managing Rectangles
You can use a rectangle, which is defined by aRect
record, to specify locations and sizes for various graphics operations. (TheRect
data type is described in the chapter "Basic QuickDraw.") You can use theSetRect
procedure to create a rectangle,OffsetRect
to move one, andInsetRect
to shrink or expand one. You can determine whether
two rectangles intersect with theSectRect
procedure, whether a pixel is enclosed in a rectangle with thePtInRect
procedure, whether two rectangles are equal with theEqualRect
procedure, and whether a rectangle is an empty rectangle with theEmptyRect
procedure. You can use theUnionRect
procedure to calculate the smallest rectangle that encloses two other rectangles,PtToAngle
to calculate the angle from the middle of a rectangle to a point, andPt2Rect
to determine the smallest rectangle that encloses two points.If the points or rectangles supplied to these routines are defined in a graphics port other than your current graphics port, you must convert them to the local coordinate system of your current graphics port. You can accomplish this by using the
SetPort
procedure to change to the graphics port containing the points or rectangles, using theLocalGlobal
procedure to convert their locations to global coordinates, usingSetPort
to return to your starting graphics port, and then using theGlobalToLocal
procedure to convert the locations of points or rectangles to the local coordinates of your current graphics port. These procedures are described in the chapter "Basic QuickDraw."
Subtopics
- SetRect
- OffsetRect
- InsetRect
- SectRect
- UnionRect
- PtInRect
- Pt2Rect
- PtToAngle
- EqualRect
- EmptyRect