TSVG2Image¶
No description yet.
| Framework | Unit | Inherits from |
|---|---|---|
| VCL | BVE.SVG2Image.VCL |
TSVG2CustomImage → TSVG2BaseControl → TGraphicControl |
| FMX | BVE.SVG2Image.FMX |
TSVG2CustomImage → TSVG2BaseControl → TControl |
| FPC | BVE.SVG2Image.FPC |
TSVG2CustomImage → TSVG2BaseControl → TGraphicControl |
Properties¶
Published, so they can be set in the Object Inspector.
AnimationTimer¶
Reference to an TSVG2AnimationTimer
AspectRatioAlign¶
Default arXMidYMid
If AutoViewbox is TRUE, this will set the align of the preserveAspectRatio property of the svg element
AspectRatioMeetOrSlice¶
Default arMeet
If AutoViewbox is TRUE, this will set the meetOrSlice of the preserveAspectRatio property of the svg element
AutoViewbox¶
Default True
This will insert a viewbox on the root element if none is present in the original svg. The content will be centered in the middle and fit into the bounds of the control, respecting aspect ratio.
Bitmap¶
read-only
The internal bitmap buffer.
BufferQuality¶
VCL, FPC only · Default bqHighQuality
The buffer quality is passed on to the render context implementation.
Clipping¶
Default False
If true, the bitmap buffer bounds are clipped to the canvas to prevent memory overflow on extreme scaling
FileName¶
Filename SVG document to be rendered (optional)
HideDesignRect¶
Default False
Hide the rectangle that is shown in the designer
MousePan¶
Default False
Dragging with the left button moves the view. Off by default.
Padding¶
Adds space between the SVG image and the edge of the control.
RenderOptions¶
Default [sroClippath, sroFilters]
sroClippath: Clippaths are rendered; sroFilters: Filters are rendered; sroEvents: SVG events are enabled.
RootID¶
The id of the svg element where rendering will start. If left empty the parser will start with the outer most SVG element.
SVG¶
Strings holding the SVG document to be rendered (optional). If set this will overrule the Filename property.
SVGBindings¶
Values bound to elements of the document.
Note
Each binding names elements with a selector - by id, tag, class or attribute - and writes its value to them, as an attribute or as their text content. Assigning a binding's Value repaints the control.
SVGDoc¶
Allows linking to a TSVGDoc component. If set, this will overrule the Filename and SVG properties.
WheelZoomStep¶
How much one notch of the wheel zooms by. 1.1 is a tenth in or out.
ZoomFactor¶
The zoom, as a factor on the size the drawing is shown at when it fits the control. Writing it zooms about the middle of the control.
Note
The same thing as SVGScaleX and SVGScaleY, which it keeps equal to each other. Kept between ZoomMin and ZoomMax.
ZoomMax¶
No description yet.
ZoomMin¶
The smallest and largest the zoom is allowed to get.
Run-time properties¶
Public, so available from code only.
AnimationTime¶
Get or set the animation time in ms
ContentBounds¶
read-only
The calculated bounds of the SVG.
ElementIndex¶
read-only
List of Element id's.
FilterBufferMaxPixels¶
Default SVGFilterBufferMaxPixelsDefault
The number of pixels a buffer rendered for a filter may take. A filter that needs more is rendered at a lower resolution and scaled up, so zooming deep into a filtered drawing stays bounded in time and memory instead of failing. Zero means no limit.
HasAnimations¶
read-only
True if the currently selected document in the root has Smil or CSS animations.
Iri¶
Resource identifier constructed from filename and root id
MouseZoom¶
FMX only · Default False
The wheel zooms, about the middle of the control. Off by default.
Note
FMX reports the wheel without saying where the pointer was, so this zooms about the middle. Call ZoomByWheel from the form's own handler to zoom about the pointer instead.
NeedsParse¶
Will force a parse of the SVG content on the next paint.
NeedsRepaint¶
Will force the SVG to be re-rendered on the next paint.
ParseErrorMessage¶
read-only
The message of the last parse error while painting, or empty when the drawing was parsed.
RenderContextType¶
read-only
Returns the render context type used.
Scale¶
VCL, FPC only
Scale of the control for Form scaling support
SVGParser¶
read-only
Pointer to the parser object of the control.
SVGRoot¶
The root of the rendering tree.
SVGRotateAngle¶
VCL, FPC only
No description yet.
SVGRotateCenterX¶
VCL, FPC only
No description yet.
SVGRotateCenterY¶
VCL, FPC only
No description yet.
SVGScaleX¶
VCL, FPC only
No description yet.
SVGScaleY¶
VCL, FPC only
No description yet.
SVGTranslateX¶
VCL, FPC only
No description yet.
SVGTranslateY¶
VCL, FPC only
No description yet.
Transform¶
VCL, FPC only
Transformation matrix
Events¶
OnAfterParse¶
Occurs after the svg is parsed and the size of the svg content is calculated.
OnLoadEmbeddedResource¶
Occurs when an embedded resource is loaded
OnLoadExternalResource¶
Occurs when an external resource is loaded
OnLog¶
Occurs when there is a log message
OnPaint¶
Occurs after the painting
OnParseError¶
Occurs when the drawing could not be parsed while the component painted, for a missing file or one that is not well-formed XML. The component shows the message in its own area either way. Calling ParseSVG raises the exception instead.
OnSVGEvent¶
Occurs on an SVG event
OnViewChanged¶
Occurs after the zoom or the pan changes, however it changed.
Methods¶
Assign¶
Copies the values from the object provided by aSource.
CalcSize¶
Set the size of the control to the intrinsic size of the SVG.
ClientToSVG¶
Turns a point on the control into a point in the drawing, in the user units of its outer svg element, undoing the zoom, the pan and the fit to the control.
Note
The fit is known once the control has painted; before that the point comes back as if the drawing were shown at its own size.
ElementBounds¶
The bounds of the element with id aID, in the coordinates of the drawing (the user units of its outer svg element), whatever the zoom, pan and fit to the control. Undefined when there is no such element or it is not rendered.
Note
An axis-aligned box that includes the stroke; for a rotated element it is the box around it, and for an element drawn in several places (a symbol placed by use) the box around all of them. Works before the first paint and after changes in code: the drawing is laid out first when needed.
ObjectAtPt¶
// VCL
function ObjectAtPt(
const aPt: TSVGPoint;
const aIfHitTest: boolean = True): ISVGObject;
// FMX
function ObjectAtPt(
const aPt: TPointF;
const aIfHitTest: boolean = True): ISVGObject;
Finds the element of type TSVGObject at the supplied user coordinates. If no element is found the function returns nil. If aIfHitTest is set to TRUE, then only TSVGObject elements that have the "Hittest" property set to TRUE are checked. It follows pointer-events, visibility and clip paths, as a click would; sroEvents is not needed for it, only for the SVG events. A shape drawn through a use element is returned as the outermost use element, so that each placement of a symbol can be told apart.
PanBy¶
Moves the view by aDX and aDY, in pixels of the control.
ParseSVG¶
Parses the drawing from SVGDoc, SVG or FileName now. Assigning those properties does not parse; the component otherwise parses when it is next painted, and then shows a parse error as text in its own area. Called directly, it raises the exception (EDOMParseError on Delphi) for a missing or malformed file, so call it inside try..except for drawings from outside the application. OnAfterParse follows a successful parse.
Repaint¶
Forces a re-render of the SVG and a repaint of the control.
ResetView¶
Puts the zoom back to 1 and the pan and rotation back to nothing, so the drawing is shown the way it is when first loaded.
SVGReadCompressed¶
No description yet.
SVGToClient¶
Turns a point in the drawing into a point on the control, the other way round from ClientToSVG.
SVGWriteCompressed¶
No description yet.
ZoomAt¶
Multiplies the zoom by aFactor while holding aPt, a point on the control, where it is. This is what zooming on the pointer means.
ZoomByWheel¶
One turn of the mouse wheel: zooms about aPt by WheelZoomStep for every notch in aWheelDelta.
Note
A control without a window of its own is never sent the wheel message, so this is called from the form's OnMouseWheel. The windowed control does it for itself when MouseZoom is on.
ZoomToElement¶
Zooms and pans so that the element with id aID fills the control. aMargin adds that fraction of the element's size on each side, so 0.1 leaves a tenth free around it. Returns False, and leaves the view alone, when there is no such element or it is not rendered.
ZoomToFit¶
Zooms and pans so that everything the drawing paints is in view.
ZoomToRect¶
Zooms and pans so that aRect, in the coordinates of the drawing, fills the control.
Inherited from the framework¶
VCL, published from TGraphicControl: Align, Anchors, Color, Constraints, DragCursor, DragKind, DragMode, Enabled, Font, OnClick, OnContextPopup, OnDblClick, OnDragDrop, OnDragOver, OnEndDock, OnEndDrag, OnGesture, OnMouseActivate, OnMouseDown, OnMouseEnter, OnMouseLeave, OnMouseMove, OnMouseUp, OnStartDock, OnStartDrag, ParentColor, ParentFont, ParentShowHint, PopupMenu, ShowHint, Touch, Visible
FMX, published from TControl: Align, Anchors, ClipChildren, ClipParent, Cursor, DesignVisible, DragMode, Enabled, EnableDragHighlight, Height, HitTest, Locked, Margins, OnClick, OnDblClick, OnDragDrop, OnDragEnd, OnDragEnter, OnDragLeave, OnDragOver, OnMouseDown, OnMouseEnter, OnMouseLeave, OnMouseMove, OnMouseUp, OnMouseWheel, OnPainting, OnResize, Opacity, PopupMenu, Position, RotationAngle, RotationCenter, Scale, Size, Visible, Width
FPC, published from TGraphicControl: Align, Anchors, BorderSpacing, Color, Constraints, DragCursor, DragKind, DragMode, Enabled, Font, OnClick, OnContextPopup, OnDblClick, OnDragDrop, OnDragOver, OnEndDock, OnEndDrag, OnMouseDown, OnMouseEnter, OnMouseLeave, OnMouseMove, OnMouseUp, OnStartDock, OnStartDrag, ParentColor, ParentFont, ParentShowHint, PopupMenu, ShowHint, Visible
Framework methods this component overrides, which behave as the framework documents them: AutoAdjustLayout, Create, Destroy, Paint, SetBounds