FMX Components Reference - Overview
This section provides comprehensive API documentation for all FMX (FireMonkey) components in the SVGIconImageList library.
Components
The library provides two main FMX components for cross-platform SVG icon support:
Core Components
TSVGIconImageList - Multi-resolution ImageList for FMX
- Cross-platform SVG icon support (Windows, macOS, iOS, Android)
- Auto-sizing bitmap generation for different scales
- Source/Destination collection architecture
- Full opacity, fixed color, and grayscale support
TSVGIconImage - Standalone image component
- Displays single SVG images
- Inherits from TImage with full FMX integration
- Multi-resolution bitmap support
- Automatic scaling for different device DPIs
Supporting Classes
- TSVGIconSourceItem - Individual icon in Source collection
- TSVGIconMultiResBitmap - Multi-resolution bitmap manager
- TFmxImageSVG - Base SVG rendering class
Key Concepts
Source/Destination Architecture
FMX ImageList uses a Source/Destination pattern:
- Source Collection: Stores the original SVG icons
- Destination Collection: Contains rendered bitmaps at requested sizes and scales
This allows the same icon to be rendered at multiple sizes and DPIs automatically.
Multi-Resolution Support
FMX components automatically handle multiple device scales:
// Component automatically creates bitmaps for 1x, 1.5x, 2x, 3x scales
SVGIconImageList1.Size := 32; // Creates 32, 48, 64, 96 pixel versionsCross-Platform Colors
FMX uses TAlphaColor instead of VCL's TColor:
SVGIconImageList1.FixedColor := TAlphaColorRec.Blue;
SVGIconImageList1.FixedColor := TAlphaColors.Null; // Inherit original colorsAutoSizeBitmaps
When AutoSizeBitmaps = True (default), bitmaps are generated dynamically based on control size. When False, you can define static bitmap sizes for each scale factor.
Platform Support
Components support these platforms:
- Windows: 32-bit and 64-bit
- macOS: 32-bit and 64-bit
- iOS: Simulator and Device (32/64-bit)
- Android: ARM 32-bit and 64-bit
Rendering Engines
FMX version supports two rendering engines (selected at compile-time):
Image32 (Default)
- Native Delphi implementation by Angus Johnson
- No external dependencies
- Good performance and compatibility
- Define:
FMX_Image32_SVGEngine
Skia4Delphi (Optional)
- Uses Skia graphics library
- Excellent rendering quality
- Hardware acceleration support
- Define:
FMX_Skia_SVGEngine
Configure in SVGIconImageList.inc file.
Key Differences from VCL
| Feature | VCL | FMX |
|---|---|---|
| Color Type | TColor | TAlphaColor |
| Base Classes | TDragImageList, TGraphicControl | TCustomImageList, TImage |
| Platforms | Windows only | Cross-platform |
| DPI Handling | Windows DPI messages | Multi-scale bitmaps |
| Rendering Engines | 4 (Image32, Skia, D2D, SVGMagic) | 2 (Image32, Skia) |
| Size Type | Integer | Single (floating point) |
Quick Start
Basic TSVGIconImageList Setup
procedure TForm1.FormCreate(Sender: TObject);
begin
// Configure
SVGIconImageList1.Size := 32;
SVGIconImageList1.FixedColor := TAlphaColorRec.Black;
SVGIconImageList1.Opacity := 0.9;
// Add icons
SVGIconImageList1.AddIcon('<svg>...</svg>', 'home');
SVGIconImageList1.LoadFromFiles(FileList);
// Use with controls
Button1.ImageIndex := 0;
ListView1.Images := SVGIconImageList1;
end;Basic TSVGIconImage Setup
procedure TForm1.FormCreate(Sender: TObject);
begin
SVGIconImage1.LoadFromFile('logo.svg');
SVGIconImage1.FixedColor := TAlphaColorRec.Blue;
SVGIconImage1.BitmapZoom := 100;
end;Constants
const
// Library version
SVGIconImageListVersion = '4.5.3';
// Default values
DEFAULT_SIZE = 32;
ZOOM_DEFAULT = 100;
// Special colors
SVG_INHERIT_COLOR = TAlphaColors.Null;
SVG_NONE_COLOR = TAlphaColors.Null;Examples
Cross-Platform Icon Loading
procedure TForm1.LoadPlatformIcons;
begin
// Works on Windows, macOS, iOS, Android
var Files := TStringList.Create;
try
{$IFDEF MSWINDOWS}
Files.Add('C:\Icons\home.svg');
{$ENDIF}
{$IFDEF MACOS}
Files.Add('/Users/Icons/home.svg');
{$ENDIF}
{$IFDEF ANDROID}
Files.Add(TPath.Combine(TPath.GetDocumentsPath, 'home.svg'));
{$ENDIF}
SVGIconImageList1.LoadFromFiles(Files);
finally
Files.Free;
end;
end;Adaptive Icon Sizing
procedure TForm1.FormResize(Sender: TObject);
begin
// Icons automatically scale with form size
if Width < 600 then
SVGIconImageList1.Size := 16
else if Width < 1024 then
SVGIconImageList1.Size := 24
else
SVGIconImageList1.Size := 32;
// Bitmaps regenerate automatically for all device scales
end;Dynamic Theme Switching
procedure TForm1.SetDarkTheme(AEnabled: Boolean);
begin
if AEnabled then
begin
Form1.Fill.Color := TAlphaColorRec.Black;
SVGIconImageList1.FixedColor := TAlphaColorRec.White;
end
else
begin
Form1.Fill.Color := TAlphaColorRec.White;
SVGIconImageList1.FixedColor := TAlphaColorRec.Black;
end;
end;