Skip to content

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

  1. 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
  2. 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

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:

pascal
// Component automatically creates bitmaps for 1x, 1.5x, 2x, 3x scales
SVGIconImageList1.Size := 32;  // Creates 32, 48, 64, 96 pixel versions

Cross-Platform Colors

FMX uses TAlphaColor instead of VCL's TColor:

pascal
SVGIconImageList1.FixedColor := TAlphaColorRec.Blue;
SVGIconImageList1.FixedColor := TAlphaColors.Null;  // Inherit original colors

AutoSizeBitmaps

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

FeatureVCLFMX
Color TypeTColorTAlphaColor
Base ClassesTDragImageList, TGraphicControlTCustomImageList, TImage
PlatformsWindows onlyCross-platform
DPI HandlingWindows DPI messagesMulti-scale bitmaps
Rendering Engines4 (Image32, Skia, D2D, SVGMagic)2 (Image32, Skia)
Size TypeIntegerSingle (floating point)

Quick Start

Basic TSVGIconImageList Setup

pascal
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

pascal
procedure TForm1.FormCreate(Sender: TObject);
begin
  SVGIconImage1.LoadFromFile('logo.svg');
  SVGIconImage1.FixedColor := TAlphaColorRec.Blue;
  SVGIconImage1.BitmapZoom := 100;
end;

Constants

pascal
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

pascal
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

pascal
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

pascal
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;

See Also

Released under Apache License, Version 2.0.