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

You can use a rectangle, which is defined by a Rect record, to specify locations and sizes for various graphics operations. (The Rect data type is described in the chapter "Basic QuickDraw.") You can use the SetRect procedure to create a rectangle, OffsetRect to move one, and InsetRect to shrink or expand one. You can determine whether
two rectangles intersect with the SectRect procedure, whether a pixel is enclosed in a rectangle with the PtInRect procedure, whether two rectangles are equal with the EqualRect procedure, and whether a rectangle is an empty rectangle with the EmptyRect procedure. You can use the UnionRect 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, and Pt2Rect 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 the LocalGlobal procedure to convert their locations to global coordinates, using SetPort to return to your starting graphics port, and then using the GlobalToLocal 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

Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996