System.Types.TRectF.FitInto

From RAD Studio API Documentation
Jump to: navigation, search

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 ADesignatedArea rectangle, then FitInto scales down the current rectangle to fit into ADesignatedArea. The scaled rectangle is centered in the ADesignatedArea rectangle 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 ADesignatedArea rectangle, then FitInto stretches the current rectangle to best fit into ADesignatedArea. The stretched rectangle is centered in the ADesignatedArea rectangle and the obtained stretched and centered rectangle is returned.
  • If any of the ADesignatedArea dimensions is zero then FitInto returns the current rectangle and sets Ratio equals to 1.

Ratio is the implemented scaling ratio.

See Also