Hide Comments
Hide Comments

Comments (0)

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: RSSVGCtrls

expandingInheritance Hierarchy

TComponent
  RSSVGCtrls.TRSSVGDocument
 

expandingSyntax

Delphi

type 
  TRSSVGDocument = class(TComponent) 
  end; 
 

expandingConstructors

 

Name

Description

public constructor

Create(TComponent)

Initializes a new instance of the TRSSVGDocument class.

public destructor

Destroy

Represents the destructor of the TRSSVGDocument class.

Top

expandingProperties

 

Name

Description

published property

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.

published property

DefaultColorInterpolation

Default Color interpolation type, which specifies the color space for gradient interpolations and alpha compositing

VCL Only

published property

DefaultColorRendering

Default Color rendering type, which provides a hint to the SVG library about how to optimize its color interpolation and compositing operations.

VCL Only

published property

DefaultShapeRendering

Default Shape rendering type, which provides a hint to the SVG library about what tradeoffs to make as it renders vector graphics elements such as path elements and basic shapes such as circles and rectangles.

VCL Only

published property

DefaultTextRendering

Default Text rendering type, which provides a hint to the SVG library about what tradeoffs to make as it renders text

VCL Only

published property

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.

published property

Filename

Defines the filename of the SVG document to load

published property

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.

published property

OnChange

Occurs when the SVG has changed and after viewers are notified

published property

OnChanging

Occurs when the SVG has changed and before viewers are notified

published property

Options

Controls how the SVG is loaded and displayed

published property

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)

public property

SVG

Provides access to the loaded SVG document

public property

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

expandingMethods

 

Name

Description

protected method

Change

Represents method Change.

protected method

LinesChange(TObject)

Represents method LinesChange(TObject).

public method

LoadSVGFromStrings(TStrings)

Loads the SVG from the TStrings parameter

protected method

SVGChange(TObject)

Represents method SVGChange(TObject).

protected method

ViewerNotify(TObject,ISVGViewer,TCollectionNotification)

Represents method ViewerNotify(TObject,ISVGViewer,TCollectionNotification).

Top

expandingEvents

 

Name

Description

published event

OnAddStyle

Occurs when a style is added to the document

published event

OnDrawing

Occurs just before a SVG element is drawn

published event

OnDrawn

Occurs just after a SVG element is drawn

published event

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

published event

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

published event

OnRemoveStyle

Occurs when a style is extracted or removed from the document

Top

expandingRemarks

alert_noteTip

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
 

 
MultipleImageFromDocFMX

alert_noteTip

Use the TRS[FMX]SVGDocument.Lines property to "bundle" your SVG document into the application

expandingExamples

To load and draw a SVG at run-time, create the SVG document and the SVG Image:

Delphi

 
 SVGDoc := TRSSVGDocument.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) SelectComponentVcl
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) SelectSVGDocVcl
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.
expandingSee Also

Reference

Comments (0)

RiverSoftAVG SVG Component Library (RSCL) © 2013-2015, Thomas G. Grubb