Important: The information in this document is obsolete and should not be used for new development.
ScalePt
To scale a height and width according to the proportions of two rectangles, use theScalePt
procedure.
PROCEDURE ScalePt (VAR pt:\xDDPoint; srcRect,dstRect:\xDDRect);
pt
- On input, an initial height and width (specified in the two fields of a
Point
record) to scale; upon completion, vertical and horizontal scaling factors derived by multiplying the height and width by ratios of the height and width of the rectangle in thesrcRect
parameter to the height and width of the rectangle in thedstRect
parameter.srcRect
- A rectangle. The ratio of this rectangle's height to the height of the rectangle in the
dstRect
parameter provides the vertical scaling factor, and the ratio of this rectangle's width to the width of the rectangle in thedstRect
parameter provides the horizontal scaling factor.dstRect
- A rectangle compared to the rectangle in the
srcRect
parameter to determine vertical and horizontal scaling factors.DESCRIPTION
TheScalePt
procedure produces horizontal and vertical scaling factors from the proportions of two rectangles. You can useScalePt
, for example, to scale the dimensions of the graphics pen.You specify an initial height and width to scale in the
pt
parameter. This parameter is of typePoint
, although you don't pass coordinates in this parameter. Instead, you pass an initial height to scale in thev
(or vertical) field of thePoint
record, and you pass an initial width to scale in theh
(or horizontal) field.The
ScalePt
procedure scales these measurements by multiplying the initial height you specify in thept
parameter by the ratio of the height of the rectangle you specify in thedstRect
parameter to the height of the rectangle you specify in thesrcRect
parameter, and by multiplying the initial width in thept
parameter by the ratio of the width of thedstRect
rectangle to the width of thesrcRect
rectangle. TheScalePt
procedure returns the result in thept
parameter.In Figure 3-23, where the width of the
dstRect
rectangle is twice the width of thesrcRect
rectangle, and its height is three times the height ofsrcRect
,ScalePt
scales the width of the graphics pen from 3 to 6 and scales its height from 2 to 6.SPECIAL CONSIDERATIONS
The minimum valueScalePt
returns is (1,1).Figure 3-23 Using
ScalePt
andMapPt