Defines a TImageList composed entirely of SVGs to enable compact, graphical support of different screen resolutions and densities.
FireMonkey is a multi-platform framework (Windows, iOS, Mac OS X, and Android), and therefore FireMonkey applications work on devices having different screen densities and resolutions. Embarcadero recommends using FireMonkey multi-resolution bitmaps so that your images and icons in FireMonkey applications will appear correctly in different densities and resolutions (Windows, iOS, Mac OS X, and Android). However, a multi-resolution bitmap is a collection of bitmap items providing the same image but having different scales . This means that multiple copies of the same image are embedded in your app - most of these copies are unused as they are intended for a different scale than the one your app is running on - potentially wasting large amounts of disk and memory space.
The TRSSVGImageList component solves this problem by creating a TImageList composed entirely of SVGs. For each SVG, you specify the sizes that the SVG should take at each screen scale. The TRSSVGImageList component generates, at run-time, bitmaps only for the current screen scale, potentially saving lots of space.
Tip
|
It is generally not recommended to use SVGs with text on non-Windows platforms unless the specified Width and Height are large. The FMX library provides poor text quality when writing to offscreen bitmaps, which is what the TRSSVGImageList does, on these platforms.
|
Namespace: FMX.RS.SVGImgList
TCustomImageList
FMX.RS.SVGImgList.TRSSVGImageList
|
Delphi
|
type
TRSSVGImageList = class(TCustomImageList)
end;
|
|
Name
|
Description
|
|
DefaultSizes
|
Specifies the collection of sizes for different screen scales. Use the DefaultSizes property to define the screen scales, and the Width and Height to generate bitmaps for each of those screen scales. When an SVG is added to the FMX.RS.SVGImgList.TRSSVGImageList.Items collection, its Sizes collection will be a copy of the current DefaultSizes collection.
|
|
Destination
|
Represents property Destination.
|
|
Items
|
Defines the collection of SVGs in the imagelist. For each SVG Item, a collection of FMX.RS.SVGImgList.TSVGSize are maintained, that specify the Width and Height of bitmaps to generate at different screen scales.
When an SVG is added to the imagelist, the component copies over the FMX.RS.SVGImgList.TRSSVGImageList.DefaultSizes collection to the Item.Sizes property.
Note
|
The SVGs are embedded into the form or data module and do not need to be deployed as separate files in your final application. The bitmaps are not stored with the imagelist. New bitmaps are created when the TRSSVGImageList is loaded.
|
|
|
OnChange
|
Represents property OnChange.
|
|
OnChanged
|
Represents property OnChanged.
|
Top
|
|
Name
|
Description
|
|
AddSource(TSVGCollectionItem)
|
Creates a Source item multi-resolution bitmap based on the SVG Item. The Source bitmap is created at only the current application scale . The method chooses the closest Size (Item.Sizes) to the current application scale, and then generates a bitmap at the Width and Height specified in the Size.
|
|
AddSVGSize(TSVGCollectionItem,TSVGSize)
|
Adds one resolution bitmap to the Source item associated with the SVG Item. The Source bitmap is created at the specified Size from the SVG.
The bitmap is added to the Source multi-resolution bitmap and does not replace any other resolutions.
|
|
Assign(TPersistent)
|
Represents method Assign(TPersistent).
|
|
FindDestination(TSourceItem)
|
Find the first Destination item that uses the Source item in one of its layers. If not destination item is found, the method returns nil.
|
|
GenerateBitmap(TSVGCollectionItem,Integer,Integer)
|
Create a bitmap of the SVG at the specified Width and Height.
The caller is responsible for freeing the bitmap.
|
|
GenerateDestinations
|
Generates the Destination data for all Source items. The Destination data has one layer created for each Source item, at only one scale.
The Destination list is completely regenerated. Any items currently in the list are destroyed.
|
|
Loaded
|
Represents method Loaded.
|
|
NameChanged(TSVGCollectionItem)
|
Called when the SVG Item name has changed. This method is used to update the Source.Name when its associated SVG Item's name has changed.
|
|
RegenerateBitmaps
|
Overloaded. Regenerates the Source collection based on all the SVG FMX.RS.SVGImgList.TRSSVGImageList.Items . Each source multi-resolution bitmap is generated at only one scale or size, chosen from the list of Sizes for the Item than most closely matches the current scale. The Size controls the width and height of the generated bitmap for one scale.
|
|
RegenerateBitmaps(TSVGCollectionItem)
|
Overloaded. Regenerates the Source item bitmap for this SVG Item.
|
|
RegenerateSource(TSVGCollectionItem)
|
Regenerates, or replaces, one resolution of a multi-resolution Source bitmap using the SVG Item. The method chooses the closest Size for the current default screen scale (TDeviceDisplayMetrics.Default.ScreenScale) and then generates the bitmap from the SVG at the chosen Width and Height.
|
|
RegenerateSVGSize(TSVGCollectionItem,TSVGSize)
|
Generates one resolution bitmap and replaces that resolution in the Source item associated with the SVG Item. The Source bitmap is created at the specified Size from the SVG.
|
|
SVGChanged(TSVGCollectionItem)
|
Called when an SVG Item has changed.
|
|
SVGNotification(TSVGCollectionItem,TCollectionNotification)
|
Called when a SVG Item is added or removed from the Itemscollection.
|
Top
|
The FMX.RS.SVGImgList.TRSSVGImageList.Items property contains the list of SVGs in the imagelist. For each SVG Item, a collection of FMX.RS.SVGImgList.TSVGSize are maintained, that specify the Width and Height of bitmaps to generate at different screen scales.
The TRSSVGImageList also maintains one Source item per SVG Item. At run-time, the TRSSVGImageList generates multi-resolution bitmaps for the Source collection from scratch, creating at most two resolutions, one at the screen scale of 1 and one at the TDeviceDisplayMetrics.Default.ScreenScale.
Note
|
The SVGs are embedded into the form or data module and do not need to be deployed as separate files in your final application. The bitmaps are not stored with the imagelist. New bitmaps are created when the TRSSVGImageList is loaded.
|
|