Provides a base class for controls which use an SVG for painting their look and feel. The control allows setting the active SVG element in the SVG; this is the element or group of elements that will be changing often and should not be prerendered (such as a compass needle). The control will automatically prerender the background and foreground (the non active element part) of the SVG.
Namespace: FMX.RS.SVGControl
Delphi
|
type
TRSSVGControl = class(TControl)
end;
|
|
Name
|
Description
|
|
ActiveSVGElement
|
Specifies the dynamic element in the SVG, the part that will be changing often. The ActiveSVGElement is not buffered when painting as it is assumed it will be changing. Set the ActiveSVGElement to tell the control which element or group of elements need to be redrawn every paint event.
The non-active svg elements are rendered either to the Background or Foreground Buffer.
Note
|
It is recommended that the active portion of the SVG not be too drawing intensive as it will slow painting.
|
|
|
Background
|
Contains the static background of the SVG compared to the ActiveSVGElement, i.e. the SVG elements that are rendered behind the ActiveSVGElement. The Background and Foreground are painted once from the SVG. When elements in the ActiveSVGElement group change, the Background and Foreground are not rendered again, significantly speeding up painting of the entire SVG.
Note
|
It is not recommended to change SVG elements in the background too often as it requires a complete rerendering of the background.
|
|
|
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
|
|
Foreground
|
Contains the static foreground of the SVG compared to the ActiveSVGElement, i.e. the SVG elements that are rendered in front of the ActiveSVGElement. The Background and Foreground are painted once from the SVG. When elements in the ActiveSVGElement group change, the Background and Foreground are not rendered again, significantly speeding up painting of the entire SVG.
Note
|
It is not recommended to change SVG elements in the background too often as it requires a complete rerendering of the background.
|
|
|
NeedBuffers
|
Controls whether the Background and Foreground need to be rendered again in the Buffered paint process. Set the NeedBuffers property to True to force the buffers to be redrawn at the next paint event.
|
|
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.
|
|
Quality
|
Controls the quality of the FMX.RS.SVGControl.TRSSVGControl.Buffered painting of the SVG image. The value of quality can vary between 1 (low quality) to 8 (very high quality).
Note
|
This property controls the amount of oversampling performed in the buffered drawing. The offscreen buffers' dimensions are multiplied by the Quality value. Then, the offscreen buffers are downsampled when painting the control, providing anti-aliasing of the buffered drawing.
This property is intended for mobile applications. The quality on desktop FMX applications is already high and requires no extra memory.
|
Warning
|
Occasionally, oversampling can cause different output compared to the unbuffered output. The extra size of the buffers requires more triangles to output gradients and other elements. If this exceeds Embarcadero's limits, the element is not drawn.
|
|
|
Stretch
|
Defines if the control draws the SVG stretched to the complete bounds of the control (True) or draws the SVG to the maximum dimensions while respecting the aspect ratio of the SVG (False).
|
|
SVG
|
Contains the SVG that paints the appearance of the control. The control changes the SVG elements based on requirements of the control. For example, a descendant control could change a specific element's fill and stroke based on a Color property change.
|
Top
|
|
Name
|
Description
|
|
DoPaint
|
Represents method DoPaint.
|
|
GetDrawRect
|
Returns the rectangle where the SVG should be drawn. This is dependent on the current stretch value, the control's width and height, and the SVG's width and height.
|
|
Invalidate
|
Represents method Invalidate.
|
|
LoadSVGResource(String)
|
Load the SVG from an embedded resource. This method initializes the ActiveSVGElement property and should be used to initialize any control fields (such as colors) that are dependant on the values in the SVG.
|
|
RecalcEnabled
|
Represents method RecalcEnabled.
|
|
Resize
|
Represents method Resize.
|
|
UpdateBuffers
|
Updates the Foreground and Background buffers with the non active elements of the SVG.
|
Top
|
This class is part of RiverSoftAVG IMPACT Instrument Package Add-on and not part of the base RiverSoftAVG SVG Component Library.
|