TCustomImageList.WidthForPPI property
Image width needed for the specified display density (PPI).
Declaration
property WidthForPPI[AImageWidth: Integer;APPI: Integer]: Integer read GetWidthForPPI;Description
WidthForPPI is an indexed read-only Integer property that contains
the widths needed for images using the specified display densities (Pixels
per Inch).
AImageWidth is an Integer value that contains the initial image
width used for the calculated width at the specified display density.
APPI is an Integer value that contains the display density used to
calculate the width of images.
Reading the value for the property causes the image width to be calculated
using the specified parameter values. If AWidth is 0 (zero) or a negative
number, the value in the Width property is used as the initial
image width.
When Scaled contains True, the image width is
calculated using the following formula:
(AImageWidth * APPI) / 96
If an image resolution does not already exist which uses the derived image width, the display density in APPI is used as a threshold for scaling using the following criteria:
| Display Density (PPI) | Scaling Factor (%) |
| 96-120 | 100% |
| 121-168 | 150% |
| 169 and higher | Calculated using (APPI / 96) * 100 |
The property value contains the image width derived using the formula:
AImageWidth * Factor div 100
When Scaled is False, image width scaling is not performed
and the value in AImageWidth is used as the property value.
The OnGetWidthForPPI event handler is signalled (when assigned) to
allow the calculated image width to be overridden. Applications can provide a
TCustomImageListGetWidthForPPI procedure which uses custom scaling
logic, or performs simple image width substitution for given display
densities.
See also
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
