System.Types.TRectF.Fit
Delphi
function Fit(const BoundsRect: TRectF): Single; // deprecated 'Please consider using FitInto instead.';
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
function | public | System.Types.pas | System.Types | TRectF |
Description
Scales down, if needed, the current rectangle to fit into BoundsRect
and centers the scaled rectangle in BoundsRect
. Returns the implemented scaling ratio.
Fit implements the following functionality:
- If any dimension of the current rectangle is greater than the corresponding dimension of the
BoundsRect
rectangle, then Fit scales down the current rectangle (keeping current rectangle proportions – the ratio between the width and height) to fit the current rectangle in theBoundsRect
rectangle. That is, the whole scaled rectangle should be fitted in the specifiedBoundsRect
rectangle. The current rectangle is placed centered in theBoundsRect
rectangle and returns the implemented scaling ratio. - If the current rectangle is smaller than the
BoundsRect
rectangle, then the current rectangle is not resized. Fit centers the current rectangle in theBoundsRect
rectangle. Fit returns the maximum value betweenwidth_of_current_rectangle/width_of_BoundsRect
andheight_of_current_rectangle/height_of_BoundsRect
. - If any of the
BoundsRect
dimensions is zero, Fit centers the current rectangle in theBoundsRect
rectangle and returns1
.