System.Types.TRectF.Fit

From RAD Studio API Documentation
Jump to: navigation, search

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 the BoundsRect rectangle. That is, the whole scaled rectangle should be fitted in the specified BoundsRect rectangle. The current rectangle is placed centered in the BoundsRect rectangle and returns the implemented scaling ratio.
    IwFit
  • If the current rectangle is smaller than the BoundsRect rectangle, then the current rectangle is not resized. Fit centers the current rectangle in the BoundsRect rectangle. Fit returns the maximum value between width_of_current_rectangle/width_of_BoundsRect and height_of_current_rectangle/height_of_BoundsRect.
    IwFit
  • If any of the BoundsRect dimensions is zero, Fit centers the current rectangle in the BoundsRect rectangle and returns 1.

See Also