Provides design-time (and run-time) access to an SVG document. Specify the Filename of the SVG to load or use the Lines property to "bundle" your SVG into the application
Namespace: FMX.RS.SVGCtrls
TComponent
FMX.RS.SVGCtrls.TRSFmxSVGDocument
|
Delphi
|
type
TRSFmxSVGDocument = class(TComponent)
end;
|
|
Name
|
Description
|
|
DefaultAspectRatio
|
Defines the default aspect ratio for the SVG. If the SVG does not specify a preserveAspectRatio attribute, the SVG will use this default instead.
|
|
DPI
|
Dots per inch used in calculating the unit factors for conversion of string lengths into actual values. The DPI should be set before loading a SVG.
For example, if the input string contains '1cm', the DPI helps the SVG library figure out how large a centimeter is.
|
|
Filename
|
Defines the filename of the SVG document to load
|
|
Lines
|
Defines the text of a SVG to load. The Lines property is useful for when you don't want to load a SVG from a file with the Filename property.
|
|
OnChange
|
Occurs when the SVG has changed and after viewers are notified
|
|
OnChanging
|
Occurs when the SVG has changed and before viewers are notified
|
|
Options
|
Controls how the SVG is loaded and displayed
|
|
PreferredLanguage
|
Specifies the preferred language to use for the SVG. The TSVGSwitch element uses the language and the SystemLanguage property of TSVGElements to choose the SVG element to display (conceptually, this is localization of text or even graphics for an SVG)
|
|
SVG
|
Provides access to the loaded SVG document
|
|
Viewers
|
Lists the SVG Viewers that are interested in this SVG document. When the SVG document is changed, all viewers in the list are notified so that they can update their display.
|
Top
|
|
Name
|
Description
|
|
OnAddStyle
|
Occurs when a style is added to the document
|
|
OnDrawing
|
Occurs just before a SVG element is drawn
|
|
OnDrawn
|
Occurs just after a SVG element is drawn
|
|
OnParsedNode
|
Occurs just after a SVG element's children are parsed by the RSCL. This event occurs when a SVG element and all of its children are loaded and parsed
|
|
OnParsingNode
|
Occurs just before a SVG element's children are parsed by the RSCL. This event occurs when a SVG element has been parsed for its own attributes but before any of its children are loaded and parsed
|
|
OnRemoveStyle
|
Occurs when a style is extracted or removed from the document
|
Top
|
Tip
|
One SVG document component can serve as the data provider for multiple TRSSVGImage controls. For example, if the SVG document contained an entire deck of cards, you could set up multiple TRSSVGImage controls for each card using the SVGRoot property
|
Tip
|
Use the TRS[FMX]SVGDocument.Lines property to "bundle" your SVG document into the application
|
|
To load and draw a SVG at run-time, create the SVG document and the SVG Image:
Delphi
|
SVGDoc := TRSFmxSVGDocument.Create(Self);
SVGDoc.Filename := 'c:\MySVG.svg';
SVGImage := TRSSVGImage.Create(Self);
SVGImage.Parent := Self;
SVGImage.SVGDocument := SVGDoc;
|
At design-time, you would:
• | Drop an SVG document component on your form ( RSSVGCtrls|TRSSVGDocument for VCL, TRSFMXSVGDocument for FMX) |
• | Set the TRS[FMX]SVGDocument.Filename property to the SVG file. Alternatively, you can directly paste the SVG into the Lines property (warning: Delphi's TStrings editor will truncate long lines causing problems with some SVG text) |
• | Drop a TRSSVGImage component on the form |
• | Connect the TRSSVGImage.SVGDocument to the RSSVGDocument1 (VCL) or RSFMXSVGDocument1 (FMX) |
• | Optionally, if you only want to display one branch of the SVG document, you can set the TRSSVGImage.SVGRoot property to the SVG element you want to display. If the SVGRoot is not empty and it does not equal any SVG element in the document, nothing is displayed. |