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 / Scaling and Mapping Points, Rectangles, Polygons, and Regions


MapPt

To map a point in one rectangle to an equivalent position in another rectangle, use the MapPt procedure.

PROCEDURE MapPt (VAR pt:\xDDPoint; srcRect,dstRect: Rect);
pt
Upon input, the point in the source rectangle to map; upon completion, its mapped position in the destination rectangle.
srcRect
The source rectangle containing the original point.
dstRect
The destination rectangle in which the point will be mapped.
DESCRIPTION
The MapPt procedure maps a point in one rectangle to an equivalent position in another rectangle.

In the pt parameter, you specify a point that lies within the rectangle that you specify in the srcRect parameter. The MapPt procedure maps this point to a similarly located point within the rectangle that you specify in the dstRect parameter--that is, to where it would fall if it were part of a drawing being expanded or shrunk to fit the destination rectangle. The MapPt procedure returns the location of the mapped point in the pt parameter. For example, a corner point of the source rectangle would be mapped to the corresponding corner point of the destination rectangle in dstRect, and the center of the source rectangle would be mapped to the center of destination rectangle.

The source and destination rectangles may overlap, and the point you specify need not actually lie within the source rectangle.

In Figure 3-23 on page 3-101, the point (3,2) in the source rectangle is mapped to (18,7) in the destination rectangle.

SEE ALSO
If you're going to draw inside the destination rectangle, you'll probably also want to scale the graphics pen size accordingly with the ScalePt procedure, described in the previous section.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996