System.Types.TRectF.FitInto
Delphi
function FitInto(const ADesignatedArea: TRectF; out Ratio: Single): TRectF; overload;
function FitInto(const ADesignatedArea: TRectF): TRectF; overload;
C++
inline TRectF TRectF::FitInto(const TRectF& DesignatedArea,
float& Ratio) const _ALWAYS_INLINE {
TRectF FitInto(const TRectF &DesignatedArea) const _ALWAYS_INLINE {
Properties
| Type | Visibility | Source | Unit | Parent |
|---|---|---|---|---|
| function | public | System.Types.pas SystemTypes.h |
System.Types | TRectF |
Description
Resizes the current rectangle, preserving the current rectangle proportions, to best fit in the ADesignatedArea rectangle, and returns the scaled rectangle centered in ADesignatedArea.
FitInto implements the following functionality:
- If any of the current rectangle dimensions is greater than the corresponding dimension of the
ADesignatedArearectangle, then FitInto scales down the current rectangle to fit intoADesignatedArea. The scaled rectangle is centered in theADesignatedArearectangle and the obtained scaled and centered rectangle is returned. - If both width and height of the current rectangle dimensions is smaller than the corresponding dimensions of the
ADesignatedArearectangle, then FitInto stretches the current rectangle to best fit intoADesignatedArea. The stretched rectangle is centered in theADesignatedArearectangle and the obtained stretched and centered rectangle is returned. - If any of the
ADesignatedAreadimensions is zero then FitInto returns the current rectangle and setsRatioequals to1.
Ratio is the implemented scaling ratio.