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 aRectrecord, to specify locations and sizes for various graphics operations. (TheRectdata type is described in the chapter "Basic QuickDraw.") You can use theSetRectprocedure to create a rectangle,OffsetRectto move one, andInsetRectto shrink or expand one. You can determine whether
two rectangles intersect with theSectRectprocedure, whether a pixel is enclosed in a rectangle with thePtInRectprocedure, whether two rectangles are equal with theEqualRectprocedure, and whether a rectangle is an empty rectangle with theEmptyRectprocedure. You can use theUnionRectprocedure to calculate the smallest rectangle that encloses two other rectangles,PtToAngleto calculate the angle from the middle of a rectangle to a point, andPt2Rectto 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
SetPortprocedure to change to the graphics port containing the points or rectangles, using theLocalGlobalprocedure to convert their locations to global coordinates, usingSetPortto return to your starting graphics port, and then using theGlobalToLocalprocedure 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