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.
|
|
EmbedSVGAsBinary
|
Controls whether the SVG document is embedded into the form as Delphi binary
Tip
|
Set EmbedSVGAsBinary to true to embed the SVG into the form as binary. Embedding SVGs as binary allows in general faster form initialization as opposed to using the FMX.RS.SVGCtrls.TRSFmxSVGDocument.Lines property or loading the SVG from a file. It is also a very useful way to deploy an SVG for mobile applications.
|
|
|
Filename
|
Defines the filename of the SVG document to load at design-time and run-time.
|
|
Lines
|
Defines the XML text of a SVG to load.
|
|
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
|
Defines options for reading, displaying, and writing the document
|
|
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
|
|
OnDisableAppearance
|
Occurs just before a disabled element is about to be drawn to the canvas. Use this event to modify the Canvas, Matrix, or aRect to provide a special appearance for disabled elements.
Set the DoDefault parameter to false to prevent the default disabled appearance (making the element grayscale) from being performed
|
|
OnDrawing
|
Occurs just before drawing the current element and its children. The event fires after the canvas brush, pen, font, clipping, etc are set up but before the actual drawing.
|
|
OnDrawn
|
Occurs just after a SVG element is drawn. The event fires after drawing the current element and its children but before the canvas is returned to its initial state.
|
|
OnElementFound
|
Occurs when an SVG element is found at the specified position during aa ElementAtPos method call. Set Element to nil to have the ElementAtPos method ignore this element and keep searching
|
|
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
|
|
OnSavedElement
|
Occurs just after a SVG element and its children are saved to an IXMLNode.
|
|
OnSavingElement
|
Occurs just before an SVG element and its children are saved to an IXMLNode. Set DoSave to False to prevent the SVG element from being saved
|
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.