Hide Comments
Hide Comments

Comments (0)

TRSSVGImage displays a graphical image of an SVG. The control ensures that the image is always of the highest resolution by redrawing the SVG when the control is rescaled.

Use TRSSVGImage to display a graphical image of a SVG on a form. Use the SVGDocument and SVGRootID properties to control which SVG is displayed in the image. TRSSVGImage introduces several properties to determine how the SVG is displayed within the boundaries of the TRSSVGImage object.

Namespace: FMX.RS.SVGCtrls

expandingInheritance Hierarchy

TControl
  FMX.RS.SVGCtrls.TRSSVGImage
 

expandingSyntax

Delphi

type
  TRSSVGImage = class(TControl, ISVGViewer)
  end;
 

expandingConstructors

 

Name

Description

public constructor

Create(TComponent)

Initializes a new instance of the TRSSVGImage class.

public destructor

Destroy

Represents the destructor of the TRSSVGImage class.

Top

expandingProperties

 

Name

Description

published property

Align

Represents property Align.

published property

Anchors

Represents property Anchors.

protected property

Bitmap

Represents property Bitmap.

published property

Buffered

Specifies whether to draw the SVG to a backbuffer and then copy that image to the canvas (default) or to draw directly on the canvas

Set the Buffered property to false to draw directly on the image canvas. This is generally not recommended, however, it may look better on mobile devices

published property

ClipChildren

Represents property ClipChildren.

published property

ClipParent

Represents property ClipParent.

published property

Cursor

Represents property Cursor.

published property

DesignVisible

Represents property DesignVisible.

published property

DisableInterpolation

Enables or disables the interpolation of the SVG bitmap displayed by this TRSSVGImage component.

The DisableInterpolation property specifies whether the interpolation is used while rendering the SVG bitmap onto the canvas displayed by this TRSSVGImage component. By default, DisableInterpolation is set to False.
 

published property

DragMode

Represents property DragMode.

published property

Enabled

Represents property Enabled.

published property

EnableDragHighlight

Represents property EnableDragHighlight.

published property

Height

Represents property Height.

published property

HitTest

Represents property HitTest.

published property

Locked

Represents property Locked.

published property

Margins

Represents property Margins.

published property

MarginWrapMode

Specifies how the margins of the SVG are resized, replicated, and positioned.

Use MarginWrapMode property to set and get how the margins of the SVG are displayed within the TRSSVGImage. By default the margins are stretched to fill the entire TRSSVGImage.

If SVGMargins property is not set, then MarginWrapMode has no effect over the image.
 
 

published property

OnClick

Represents property OnClick.

published property

OnDblClick

Represents property OnDblClick.

published property

OnDragDrop

Represents property OnDragDrop.

published property

OnDragEnd

Represents property OnDragEnd.

published property

OnDragEnter

Represents property OnDragEnter.

published property

OnDragLeave

Represents property OnDragLeave.

published property

OnDragOver

Represents property OnDragOver.

published property

OnMouseDown

Represents property OnMouseDown.

published property

OnMouseEnter

Represents property OnMouseEnter.

published property

OnMouseLeave

Represents property OnMouseLeave.

published property

OnMouseMove

Represents property OnMouseMove.

published property

OnMouseUp

Represents property OnMouseUp.

published property

OnMouseWheel

Represents property OnMouseWheel.

published property

OnPaint

Represents property OnPaint.

published property

OnPainting

Represents property OnPainting.

published property

OnResize

Represents property OnResize.

published property

Opacity

Represents property Opacity.

published property

Padding

Represents property Padding.

published property

PopupMenu

Represents property PopupMenu.

published property

Position

Represents property Position.

published property

RotationAngle

Represents property RotationAngle.

published property

RotationCenter

Represents property RotationCenter.

published property

Scale

Represents property Scale.

published property

ScaleOriginal

Specifies the scale factor for drawing the SVG.

Use the ScaleOriginal property to scale the SVG larger or smaller within the TRSSVGImage component. This is useful for controlling the tiling the SVG or zooming in or out of the SVG

published property

SVGDocument

Specifies the SVG document to display in the control. The SVGDocument and SVGRootID properties control exactly which SVG document and which branch of the SVG document hierarchy to display.

published property

SVGMargins

Specifies the margins of the SVG displayed by this TRSSVGImage component.

Set or read the SVGMargins property in order to affect the margins of the SVG that is displayed by this TRSSVGImage component
 

protected property

SVGRoot

Represents property SVGRoot.

published property

SVGRootID

Specifies which node of the SVGDocument to draw as the top- level SVG document.

Use the SVGRootID property to display only a portion of the SVGDocument .

published property

Visible

Represents property Visible.

published property

Width

Represents property Width.

published property

WrapMode

Specifies whether and how to resize, replicate, and position the SVG image for rendering the TRSSVGImage surface.

The WrapMode property should be one of the constants defined in the TSVGImageWrapMode type:

iwOriginal-- displays the SVG with its original dimensions.

iwFit-- best fit (keeping SVG proportions--the ratio between the width and height) for the TRSSVGImage rectangle. Default.

iwStretch--stretches the SVG to fill the entire rectangle of this TRSSVGImage component.

iwTile--tiles the TRSSVGImage image to cover the entire rectangle of the TRSSVGImage component.

iwCenter-- center the SVG inside the TRSSVGImage component
 

Top

expandingMethods

 

Name

Description

protected method

DoSVGChanged(TObject)

Represents method DoSVGChanged(TObject).

protected method

GetBitmap

Represents method GetBitmap.

protected method

GetSVGRoot

Represents method GetSVGRoot.

public method

IsBuffered

Returns True if the SVG should be drawn to a offscreen bitmap

protected method

Notification(TComponent,TOperation)

Represents method Notification(TComponent,TOperation).

protected method

Paint

Represents method Paint.

protected method

Resize

Represents method Resize.

protected method

UpdateBitmap

Represents method UpdateBitmap.

Top

expandingRemarks

alert_noteTip

By default, TRSSVGImage draws the SVG to a offscreen bitmap and then draws that bitmap to the control's canvas as needed. This is recommended as it is faster. However, on mobile devices, you may see some aliasing. If you set the Buffered property to false, the TRSSVGImage class will draw the SVG directly to the control's canvas which will reduce aliasing.

alert_noteTip

The TRSSVGImage always loads and draws the SVG image from the TRSFmxSVGDocument in the context of the main GUI thread. For more complex SVG documents, you may want to use the TRSSVGThreadImage control to load and draw a SVG within a background thread.

alert_cautionWarning

If the SVGRootID property is not empty, the ID must exist in the SVG document or nothing is displayed.

expandingExamples

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) 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

Comments (0)

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