Sign in Join
FPDoc Onlineexperiment

TCustomImageListResolutions.FindBestToScaleFrom function

Member of TCustomImageListResolutionspublicIn unit ImgList

Finds the image resolution with the best size for scaling to the target width.

Declaration

pascal
function FindBestToScaleFrom(const ATargetWidth: Integer): Integer

Arguments

ATargetWidth

Target width for the scaled image resolution.

Function result

Source image resolution to use for scaling to the target width.

Description

FindBestToScaleFrom is an Integer function used to find the image resolution that is the best candidate for scaling images to the specified target width.

ATargetWidth contains the image width to locate in the resolutions stored in the container.

The return value contains the ordinal position for the image resolution selected as the source for images.

FindBestToScaleFrom calls the Find method to locate an existing image resolution that matches the value in ATargetWidth. If an existing image resolution is not found that uses the image width in ATargetWidth, the FindBestToCopyFrom method is called to search all resolutions for the best candidate for the target image width.

FindBestToScaleFrom is used in the implementation of the StretchDraw method in TCustomImageList.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.