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

expandingInheritance Hierarchy

TRSCustomTransparentGraphicControl
  RSSVGCtrls.TRSSVGImage
 

expandingSyntax

Delphi

type
  TRSSVGImage = class(TRSCustomTransparentGraphicControl, ISVGViewer, IRSGPControl)
  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

public property

AbsoluteMatrix

Represents property AbsoluteMatrix.

published property

Align

Represents property Align.

published property

Anchors

Represents property Anchors.

published property

AutoSize

Represents property AutoSize.

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

Constraints

Represents property Constraints.

published property

DragCursor

Represents property DragCursor.

published property

DragKind

Represents property DragKind.

published property

DragMode

Represents property DragMode.

published property

Enabled

Represents property Enabled.

public property

Matrix

Represents property Matrix.

published property

OnClick

Represents property OnClick.

published property

OnContextPopup

Represents property OnContextPopup.

published property

OnDblClick

Represents property OnDblClick.

published property

OnDragDrop

Represents property OnDragDrop.

published property

OnDragOver

Represents property OnDragOver.

published property

OnEndDock

Represents property OnEndDock.

published property

OnEndDrag

Represents property OnEndDrag.

published property

OnGesture

Represents property OnGesture.

published property

OnMouseActivate

Represents property OnMouseActivate.

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

OnStartDock

Represents property OnStartDock.

published property

OnStartDrag

Represents property OnStartDrag.

published property

Opacity

Specifies the opacity or transparency of the SVG image. If Opacity is less than 1, then the SVG is displayed semi- transparent. If Opacity is 0, then the SVG is not displayed.

published property

ParentShowHint

Represents property ParentShowHint.

published property

PopupMenu

Represents property PopupMenu.

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

ShowHint

Represents property ShowHint.

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.

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

Touch

Represents property Touch.

published property

Transform

Specifies the overall transformation to apply to the SVG image. For no transformation, set the Matrix to the RSIdentityMatrix

published property

Visible

Represents property Visible.

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

public method

GetAbsoluteMatrix

Represents method GetAbsoluteMatrix.

public method

GetMatrix

Represents method GetMatrix.

public method

GetOpacity

Represents method GetOpacity.

protected method

GetShapeRect(TObject,TRSRect)

Represents method GetShapeRect(TObject,TRSRect).

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

ObjectChanged(TObject)

Represents method ObjectChanged(TObject).

protected method

Paint

Represents method Paint.

protected method

Resize

Represents method Resize.

public method

SetOpacity(Single)

Represents method SetOpacity(Single).

protected method

UpdateBitmap

Represents method UpdateBitmap.

Top

expandingRemarks

alert_noteTip

The TRSSVGImage always loads and draws the SVG image from the TRSSVGDocument 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 := 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

Comments (0)

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