Important: The information in this document is obsolete and should not be used for new development.
MapPt
To map a point in one rectangle to an equivalent position in another rectangle, use theMapPt
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
TheMapPt
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 thesrcRect
parameter. TheMapPt
procedure maps this point to a similarly located point within the rectangle that you specify in thedstRect
parameter--that is, to where it would fall if it were part of a drawing being expanded or shrunk to fit the destination rectangle. TheMapPt
procedure returns the location of the mapped point in thept
parameter. For example, a corner point of the source rectangle would be mapped to the corresponding corner point of the destination rectangle indstRect
, 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 theScalePt
procedure, described in the previous section.